You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by cd...@apache.org on 2017/04/16 22:32:04 UTC
[13/72] [abbrv] [partial] flex-blazeds git commit: - Major code scrub
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/flex/messaging/messages/AsyncMessage.java
----------------------------------------------------------------------
diff --git a/core/src/flex/messaging/messages/AsyncMessage.java b/core/src/flex/messaging/messages/AsyncMessage.java
deleted file mode 100644
index efb4b9a..0000000
--- a/core/src/flex/messaging/messages/AsyncMessage.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package flex.messaging.messages;
-
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-
-import flex.messaging.util.UUIDUtils;
-import flex.messaging.log.Log;
-
-/**
- * This type of message contains information necessary to perform
- * point-to-point or publish-subscribe messaging.
- */
-public class AsyncMessage extends AbstractMessage implements SmallMessage
-{
- /**
- * This number was generated using the 'serialver' command line tool.
- * This number should remain consistent with the version used by
- * ColdFusion to communicate with the message broker over RMI.
- */
- private static final long serialVersionUID = -3549535089417916783L;
-
- /**
- * The name for the subtopic header if the message targets a destination
- * subtopic.
- */
- public static final String SUBTOPIC_HEADER_NAME = "DSSubtopic";
-
- // Serialization constants
- private static byte CORRELATION_ID_FLAG = 1;
- private static byte CORRELATION_ID_BYTES_FLAG = 2;
-
- protected String correlationId;
- protected byte[] correlationIdBytes;
-
- /**
- * Default constructor for <code>AsyncMessage</code>.
- */
- public AsyncMessage()
- {
- // No-op.
- }
-
- /**
- * Gets the correlationId of the <code>AsyncMessage</code>.
- *
- * @return The correlation id.
- */
- public String getCorrelationId()
- {
- return correlationId;
- }
-
- /**
- * Sets the correlationId of the <code>AsyncMessage</code>.
- *
- * @param correlationId The correlationId for the message.
- */
- public void setCorrelationId(String correlationId)
- {
- this.correlationId = correlationId;
- }
-
- /**
- *
- */
- public Message getSmallMessage()
- {
- return getClass() == AsyncMessage.class? new AsyncMessageExt(this) : null;
- }
-
- /**
- *
- */
- @Override public void readExternal(ObjectInput input)throws IOException, ClassNotFoundException
- {
- super.readExternal(input);
-
- short[] flagsArray = readFlags(input);
- for (int i = 0; i < flagsArray.length; i++)
- {
- short flags = flagsArray[i];
- short reservedPosition = 0;
-
- if (i == 0)
- {
- if ((flags & CORRELATION_ID_FLAG) != 0)
- correlationId = (String)input.readObject();
-
- if ((flags & CORRELATION_ID_BYTES_FLAG) != 0)
- {
- correlationIdBytes = (byte[])input.readObject();
- correlationId = UUIDUtils.fromByteArray(correlationIdBytes);
- }
-
- reservedPosition = 2;
- }
-
- // For forwards compatibility, read in any other flagged objects
- // to preserve the integrity of the input stream...
- if ((flags >> reservedPosition) != 0)
- {
- for (short j = reservedPosition; j < 6; j++)
- {
- if (((flags >> j) & 1) != 0)
- input.readObject();
- }
- }
- }
- }
-
- /**
- *
- */
- @Override public void writeExternal(ObjectOutput output) throws IOException
- {
- super.writeExternal(output);
-
- if (correlationIdBytes == null && correlationId != null)
- correlationIdBytes = UUIDUtils.toByteArray(correlationId);
-
- short flags = 0;
-
- if (correlationId != null && correlationIdBytes == null)
- flags |= CORRELATION_ID_FLAG;
-
- if (correlationIdBytes != null)
- flags |= CORRELATION_ID_BYTES_FLAG;
-
- output.writeByte(flags);
-
- if (correlationId != null && correlationIdBytes == null)
- output.writeObject(correlationId);
-
- if (correlationIdBytes != null)
- output.writeObject(correlationIdBytes);
- }
-
- @Override protected String toStringFields(int indentLevel)
- {
- String sep = getFieldSeparator(indentLevel);
- String s = sep + "clientId = " + (Log.isExcludedProperty("clientId") ? Log.VALUE_SUPRESSED : clientId);
- s += sep + "correlationId = " + (Log.isExcludedProperty("correlationId") ? Log.VALUE_SUPRESSED : correlationId);
- s += sep + "destination = " + (Log.isExcludedProperty("destination") ? Log.VALUE_SUPRESSED : destination);
- s += sep + "messageId = " + (Log.isExcludedProperty("messageId") ? Log.VALUE_SUPRESSED : messageId);
- s += sep + "timestamp = " + (Log.isExcludedProperty("timestamp") ? Log.VALUE_SUPRESSED : String.valueOf(timestamp));
- s += sep + "timeToLive = " + (Log.isExcludedProperty("timeToLive") ? Log.VALUE_SUPRESSED : String.valueOf(timeToLive));
- s += sep + "body = " + (Log.isExcludedProperty("body") ? Log.VALUE_SUPRESSED : bodyToString(body, indentLevel));
- s += super.toStringFields(indentLevel);
- return s;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/flex/messaging/messages/AsyncMessageExt.java
----------------------------------------------------------------------
diff --git a/core/src/flex/messaging/messages/AsyncMessageExt.java b/core/src/flex/messaging/messages/AsyncMessageExt.java
deleted file mode 100644
index 1c79363..0000000
--- a/core/src/flex/messaging/messages/AsyncMessageExt.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package flex.messaging.messages;
-
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectOutput;
-
-import flex.messaging.io.ClassAlias;
-
-/**
- *
- */
-public class AsyncMessageExt extends AsyncMessage implements Externalizable, ClassAlias
-{
- private static final long serialVersionUID = -5371460213241777011L;
- public static final String CLASS_ALIAS = "DSA";
-
- public AsyncMessageExt()
- {
- super();
- }
-
- public AsyncMessageExt(AsyncMessage message)
- {
- super();
- _message = message;
- }
-
- public String getAlias()
- {
- return CLASS_ALIAS;
- }
-
- public void writeExternal(ObjectOutput output) throws IOException
- {
- if (_message != null)
- _message.writeExternal(output);
- else
- super.writeExternal(output);
- }
-
- private AsyncMessage _message;
-}
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/flex/messaging/messages/BatchableMessage.java
----------------------------------------------------------------------
diff --git a/core/src/flex/messaging/messages/BatchableMessage.java b/core/src/flex/messaging/messages/BatchableMessage.java
deleted file mode 100644
index df11fb5..0000000
--- a/core/src/flex/messaging/messages/BatchableMessage.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package flex.messaging.messages;
-
-/**
- * Implemented by messages that may be batched.
- *
- *
- */
-public interface BatchableMessage
-{
- /**
- * Returns true if the message is batched.
- *
- * @return true if this message is batched
- */
- boolean isBatched();
-}
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/flex/messaging/messages/CommandMessage.java
----------------------------------------------------------------------
diff --git a/core/src/flex/messaging/messages/CommandMessage.java b/core/src/flex/messaging/messages/CommandMessage.java
deleted file mode 100644
index 7e2ca85..0000000
--- a/core/src/flex/messaging/messages/CommandMessage.java
+++ /dev/null
@@ -1,399 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package flex.messaging.messages;
-
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-
-import flex.messaging.log.LogCategories;
-import flex.messaging.util.UUIDUtils;
-
-/**
- * A message that represents an infrastructure command passed between
- * client and server. Subscribe/unsubscribe operations result in
- * CommandMessage transmissions, as do polling operations.
- */
-public class CommandMessage extends AsyncMessage
-{
- /** Log category for <code>CommandMessage</code>.*/
- public static final String LOG_CATEGORY = LogCategories.MESSAGE_COMMAND;
-
- // THESE VALUES MUST BE THE SAME ON CLIENT AND SERVER
- /**
- * This operation is used to subscribe to a remote destination.
- */
- public static final int SUBSCRIBE_OPERATION = 0;
-
- /**
- * This operation is used to unsubscribe from a remote destination.
- */
- public static final int UNSUBSCRIBE_OPERATION = 1;
-
- /**
- * This operation is used to poll a remote destination for pending,
- * undelivered messages.
- */
- public static final int POLL_OPERATION = 2;
-
- /**
- * This operation is used by a remote destination to sync missed or cached messages
- * back to a client as a result of a client issued poll command.
- */
- public static final int CLIENT_SYNC_OPERATION = 4;
-
- /**
- * This operation is used to test connectivity over the current channel to
- * the remote endpoint.
- */
- public static final int CLIENT_PING_OPERATION = 5;
-
- /**
- * This operation is used to request a list of failover endpoint URIs
- * for the remote destination based on cluster membership.
- */
- public static final int CLUSTER_REQUEST_OPERATION = 7;
-
- /**
- * This operation is used to send credentials to the endpoint so that
- * the user can be logged in over the current channel.
- * The credentials need to be Base64 encoded and stored in the <code>body</code>
- * of the message.
- */
- public static final int LOGIN_OPERATION = 8;
-
- /**
- * This operation is used to log the user out of the current channel, and
- * will invalidate the server session if the channel is HTTP based.
- */
- public static final int LOGOUT_OPERATION = 9;
-
- /**
- * This operation is used to indicate that the client's subscription to a
- * remote destination has been invalidated.
- */
- public static final int SUBSCRIPTION_INVALIDATE_OPERATION = 10;
-
- /**
- * This operation is used by the MultiTopicConsumer to subscribe/unsubscribe
- * from multiple subtopics/selectors in the same message.
- */
- public static final int MULTI_SUBSCRIBE_OPERATION = 11;
-
- /**
- * This operation is used to indicate that a channel has disconnected.
- */
- public static final int DISCONNECT_OPERATION = 12;
-
- /**
- * This operation is used to trigger a client connect attempt.
- */
- public static final int TRIGGER_CONNECT_OPERATION = 13;
-
- /**
- * This is the default operation for new CommandMessage instances.
- */
- public static final int UNKNOWN_OPERATION = 10000;
-
- /**
- * Endpoints can imply what features they support by reporting the
- * latest version of messaging they are capable of during the handshake of
- * the initial ping CommandMessage.
- */
- public static final String MESSAGING_VERSION = "DSMessagingVersion";
-
- /**
- * The name for the selector header in subscribe messages.
- */
- public static final String SELECTOR_HEADER = "DSSelector";
-
- /**
- * The name for the header used internaly on the server to indicate that an unsubscribe
- * message is due to a client subscription being invalidated.
- */
- public static final String SUBSCRIPTION_INVALIDATED_HEADER = "DSSubscriptionInvalidated";
-
- /**
- * Durable JMS subscriptions are preserved when an unsubscribe message
- * has this parameter set to true in its header.
- */
- public static final String PRESERVE_DURABLE_HEADER= "DSPreserveDurable";
-
- /**
- * Header to indicate that the Channel needs the configuration from the
- * server.
- */
- public static final String NEEDS_CONFIG_HEADER = "DSNeedsConfig";
-
- /**
- * Header used in a MULTI_SUBSCRIBE message to specify an Array of subtopic/selector
- * pairs to add to the existing set of subscriptions.
- */
- public static final String ADD_SUBSCRIPTIONS = "DSAddSub";
-
- /**
- * Like the above, but specifies the subtopic/selector array of to remove.
- */
- public static final String REMOVE_SUBSCRIPTIONS = "DSRemSub";
-
- /**
- * The separator used in the add and remove subscription headers for
- * multi subscribe messages.
- */
- public static final String SUBTOPIC_SEPARATOR = "_;_";
-
- /**
- * Header to drive an idle wait time before the next client poll request.
- */
- public static final String POLL_WAIT_HEADER = "DSPollWait";
-
- /**
- * Header to suppress poll response processing. If a client has a long-poll
- * parked on the server and issues another poll, the response to this subsequent poll
- * should be tagged with this header in which case the response is treated as a
- * no-op and the next poll will not be scheduled. Without this, a subsequent poll
- * will put the channel and endpoint into a busy polling cycle.
- */
- public static final String NO_OP_POLL_HEADER = "DSNoOpPoll";
-
- /**
- *
- * Internal header used to tag poll messages when a poll-wait must be suppressed.
- */
- public static final String SUPPRESS_POLL_WAIT_HEADER = "DSSuppressPollWait";
-
- /**
- * Header to specify which character set encoding was used while encoding
- * login credentials.
- */
- public static final String CREDENTIALS_CHARSET_HEADER = "DSCredentialsCharset";
-
- /**
- * Header to indicate the maximum number of messages a Consumer wants to
- * receive per second.
- */
- public static final String MAX_FREQUENCY_HEADER = "DSMaxFrequency";
-
- /**
- * Header that indicates the message is a heartbeat.
- */
- public static final String HEARTBEAT_HEADER = "DS<3";
-
- /**
- * Header that indicates the client application has successfully registered for push notifications.
- */
- public static final String PUSH_NOTIFICATION_REGISTERED_HEADER = "DSApplicationRegisteredForPush";
-
- /**
- * Header that provides additional meta-information when the client has registered for push notifications.
- */
- public static final String PUSH_REGISTRATION_INFORMATION = "DSPushRegisteredInformation";
-
- /**
- *
- * The position of the operation flag within all flags.
- * Constant used during serialization.
- */
- private static byte OPERATION_FLAG = 1;
-
- /**
- * This number was generated using the 'serialver' command line tool.
- * This number should remain consistent with the version used by
- * ColdFusion to communicate with the message broker over RMI.
- */
- private static final long serialVersionUID = -4026438615587526303L;
-
- /**
- * The operation names that map to each of the operation constants above.
- * The constants in this list should remain parallel to the above constants
- */
- static final String [] operationNames = {
- "subscribe", "unsubscribe", "poll", "unused3", "client_sync", "client_ping",
- "unused6", "cluster_request", "login", "logout", "subscription_invalidate",
- "multi_subscribe", "disconnect", "trigger_connect", "state_change"
- };
-
- /**
- * The operation to execute for messages of this type.
- */
- private int operation = UNKNOWN_OPERATION;
-
- /**
- * Constructs a <code>CommandMessage</code> instance.
- * The message id is set to a universally unique value, and the
- * timestamp for the message is set to the current system timestamp.
- * The operation is set to a default value of <code>UNKNOWN_OPERATION</code>.
- */
- public CommandMessage()
- {
- this.messageId = UUIDUtils.createUUID();
- this.timestamp = System.currentTimeMillis();
- }
-
- /**
- * Constructs a <code>CommandMessage</code> instance.
- * The message id is set to a universally unique value, and the
- * timestamp for the message is set to the current system timestamp.
- *
- * @param operation The operation for the <code>CommandMessage</code>; one of the operation constants.
- */
- public CommandMessage(int operation)
- {
- this();
- this.operation = operation;
- }
-
- /**
- * Returns the operation for this <code>CommandMessage</code>.
- *
- * @return The operation for this <code>CommandMessage</code>.
- */
- public int getOperation()
- {
- return operation;
- }
-
- /**
- * Sets the operation for this <code>CommandMessage</code>.
- *
- * @param operation The operation for this <code>CommandMessage</code>.
- */
- public void setOperation(int operation)
- {
- this.operation = operation;
- }
-
- /**
- *
- */
- public Message getSmallMessage()
- {
- // We shouldn't use small messages for PING or LOGIN operations as the
- // messaging version handshake would not yet be complete... for now just
- // optimize POLL operations.
- if (operation == POLL_OPERATION)
- {
- return new CommandMessageExt(this);
- }
-
- return null;
- }
-
- /**
- *
- * Debugging function which returns the name of the operation for
- * a given operation code.
- */
- public static String operationToString(int operation)
- {
- if (operation < 0 || operation >= operationNames.length)
- return "invalid." + operation;
- return operationNames[operation];
- }
-
- /**
- *
- */
- public void readExternal(ObjectInput input)throws IOException, ClassNotFoundException
- {
- super.readExternal(input);
-
- short[] flagsArray = readFlags(input);
- for (int i = 0; i < flagsArray.length; i++)
- {
- short flags = flagsArray[i];
- short reservedPosition = 0;
-
- if (i == 0)
- {
- if ((flags & OPERATION_FLAG) != 0)
- operation = ((Number)input.readObject()).intValue();
-
- reservedPosition = 1;
- }
-
- // For forwards compatibility, read in any other flagged objects
- // to preserve the integrity of the input stream...
- if ((flags >> reservedPosition) != 0)
- {
- for (short j = reservedPosition; j < 6; j++)
- {
- if (((flags >> j) & 1) != 0)
- {
- input.readObject();
- }
- }
- }
- }
- }
-
- /**
- *
- * Utility method to pretty print a <code>CommandMessage</code>.
- *
- * @param indentLevel This method may be invoked recursively so this argument
- * allows nested messages to print relative to the current print stack.
- */
- protected String toStringFields(int indentLevel)
- {
- String sep = getFieldSeparator(indentLevel);
- String s = sep + "operation = " + operationToString(operation);
- if (operation == SUBSCRIBE_OPERATION)
- s += sep + "selector = " + getHeader(SELECTOR_HEADER);
- if (operation != LOGIN_OPERATION)
- {
- s += super.toStringFields(indentLevel);
- }
- else
- {
- s += sep + "clientId = " + clientId;
- s += sep + "destination = " + destination;
- s += sep + "messageId = " + messageId;
- s += sep + "timestamp = " + timestamp;
- s += sep + "timeToLive = " + timeToLive;
- s += sep + "***not printing credentials***";
- }
- return s;
- }
-
- /**
- *
- */
- public void writeExternal(ObjectOutput output) throws IOException
- {
- super.writeExternal(output);
-
- short flags = 0;
-
- if (operation != 0)
- flags |= OPERATION_FLAG;
-
- output.writeByte(flags);
-
- if (operation != 0)
- output.writeObject(new Integer(operation));
- }
-
- /**
- *
- * Utility method to build the log category to use for logging <code>CommandMessage</code>s.
- */
- public String logCategory()
- {
- return LOG_CATEGORY + "." + operationToString(operation);
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/flex/messaging/messages/CommandMessageExt.java
----------------------------------------------------------------------
diff --git a/core/src/flex/messaging/messages/CommandMessageExt.java b/core/src/flex/messaging/messages/CommandMessageExt.java
deleted file mode 100644
index 4507a89..0000000
--- a/core/src/flex/messaging/messages/CommandMessageExt.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package flex.messaging.messages;
-
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectOutput;
-
-import flex.messaging.io.ClassAlias;
-
-/**
- *
- */
-public class CommandMessageExt extends CommandMessage implements Externalizable, ClassAlias
-{
- private static final long serialVersionUID = -5371460213241777011L;
- public static final String CLASS_ALIAS = "DSC";
-
- public CommandMessageExt()
- {
- super();
- }
-
- public CommandMessageExt(CommandMessage message)
- {
- super();
- _message = message;
- }
-
- public String getAlias()
- {
- return CLASS_ALIAS;
- }
-
- public void writeExternal(ObjectOutput output) throws IOException
- {
- if (_message != null)
- _message.writeExternal(output);
- else
- super.writeExternal(output);
- }
-
- private CommandMessage _message;
-}
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/flex/messaging/messages/ErrorMessage.java
----------------------------------------------------------------------
diff --git a/core/src/flex/messaging/messages/ErrorMessage.java b/core/src/flex/messaging/messages/ErrorMessage.java
deleted file mode 100644
index 326dcce..0000000
--- a/core/src/flex/messaging/messages/ErrorMessage.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package flex.messaging.messages;
-
-import flex.messaging.MessageException;
-import flex.messaging.log.Log;
-
-import java.util.Map;
-
-/**
- * A message describing a MessageException.
- *
- *
- */
-public class ErrorMessage extends AcknowledgeMessage
-{
- /**
- * This number was generated using the 'serialver' command line tool.
- * This number should remain consistent with the version used by
- * ColdFusion to communicate with the message broker over RMI.
- */
- private static final long serialVersionUID = -9069412644250075809L;
-
- public String faultCode;
- public String faultString;
- public String faultDetail;
- public Object rootCause;
- public Map extendedData;
-
- public ErrorMessage(MessageException mxe)
- {
- faultCode = mxe.getCode();
- faultString = mxe.getMessage();
- faultDetail = mxe.getDetails();
- if (mxe.getRootCause() != null)
- {
- rootCause = mxe.getRootCauseErrorMessage();
- }
- Map extendedData = mxe.getExtendedData();
- if (extendedData != null)
- {
- this.extendedData = extendedData;
- }
- }
-
- public ErrorMessage()
- {
- }
-
- /**
- *
- */
- public Message getSmallMessage()
- {
- return null;
- }
-
- protected String toStringFields(int indentLevel)
- {
- String sep = getFieldSeparator(indentLevel);
- String s = super.toStringFields(indentLevel);
- s += sep + "code = " + faultCode;
- s += sep + "message = " + faultString;
- s += sep + "details = " + faultDetail;
- s += sep + "rootCause = ";
- if (rootCause == null) s += "null";
- else s += rootCause.toString();
- if (Log.isExcludedProperty("body"))
- s += sep + "body = " + Log.VALUE_SUPRESSED;
- else
- s += sep + "body = " + bodyToString(body, indentLevel);
- s += sep + "extendedData = " + bodyToString(extendedData, indentLevel);
- return s;
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/flex/messaging/messages/HTTPMessage.java
----------------------------------------------------------------------
diff --git a/core/src/flex/messaging/messages/HTTPMessage.java b/core/src/flex/messaging/messages/HTTPMessage.java
deleted file mode 100644
index 9ee65d7..0000000
--- a/core/src/flex/messaging/messages/HTTPMessage.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package flex.messaging.messages;
-
-import flex.messaging.util.StringUtils;
-import flex.messaging.util.URLDecoder;
-
-import java.io.UnsupportedEncodingException;
-import java.util.Map;
-
-/**
- * An HTTPMessage specifies a destination that
- * needs to be resolved into a String
- * representation of an HTTP or HTTPS URI
- * endpoint.
- * <p>
- * The method takes values such as GET, POST,
- * HEAD etc.
- * </p>
- *
- *
- */
-public class HTTPMessage extends RPCMessage
-{
- public HTTPMessage()
- {
- }
-
- /**
- * This number was generated using the 'serialver' command line tool.
- * This number should remain consistent with the version used by
- * ColdFusion to communicate with the message broker over RMI.
- */
- private static final long serialVersionUID = 5954910346466323369L;
-
- protected String contentType;
- protected String method;
- protected String url;
- protected Map httpHeaders;
- protected boolean recordHeaders;
-
- public String getContentType()
- {
- return contentType;
- }
-
- public void setContentType(String type)
- {
- contentType = type;
- }
-
- public String getMethod()
- {
- return method;
- }
-
- public void setMethod(String m)
- {
- if (m != null)
- {
- method = m.trim().toUpperCase();
- }
- else
- {
- method = m;
- }
- }
-
- public Map getHttpHeaders()
- {
- return httpHeaders;
- }
-
- public void setHttpHeaders(Map h)
- {
- httpHeaders = h;
- }
-
- public void setUrl(String s)
- {
- try
- {
- url = URLDecoder.decode(s, "UTF-8");
- }
- catch (UnsupportedEncodingException e)
- {
- url = s;
- }
- }
-
- public String getUrl()
- {
- return url;
- }
-
- public boolean getRecordHeaders()
- {
- return recordHeaders;
- }
-
- public void setRecordHeaders(boolean recordHeaders)
- {
- this.recordHeaders = recordHeaders;
- }
-
- protected String toStringFields(int indentLevel)
- {
- String sep = getFieldSeparator(indentLevel);
- StringBuilder sb = new StringBuilder();
- sb.append(sep).append("method = ").append(getMethod()).
- append(sep).append("url = ").append(getUrl()).
- append(sep).append("headers = ").append(getHeaders());
- sb.append(super.toStringFields(indentLevel));
- return sb.toString();
- }
-
- protected String internalBodyToString(Object body, int indentLevel)
- {
- return body instanceof String ?
- StringUtils.prettifyString((String) body) :
- super.internalBodyToString(body, indentLevel);
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/flex/messaging/messages/Message.java
----------------------------------------------------------------------
diff --git a/core/src/flex/messaging/messages/Message.java b/core/src/flex/messaging/messages/Message.java
deleted file mode 100644
index 85c4397..0000000
--- a/core/src/flex/messaging/messages/Message.java
+++ /dev/null
@@ -1,235 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package flex.messaging.messages;
-
-import java.io.Serializable;
-import java.util.Map;
-
-/**
- * Messages are sent from Endpoints into the MessageBroker, which then
- * sends them to a Service. The MessageBroker also sends Messages to
- * Endpoints, and a Service may ask its Broker to send Messages to
- * Endpoints.
- */
-public interface Message
- extends Serializable, Cloneable, Comparable<Message> //, javax.jms.Message
-{
- // Message header name constants
- /**
- * This header is used to transport the FlexClient Id value in messages
- * sent clients to the server.
- */
- String FLEX_CLIENT_ID_HEADER = "DSId";
-
- /**
- * The name for the destination client Id header, used to target a message
- * back to the proper client when multiple clients share a channel.
- */
- String DESTINATION_CLIENT_ID_HEADER = "DSDstClientId";
-
- /**
- * The name for the endpoint header.
- */
- String ENDPOINT_HEADER = "DSEndpoint";
-
- /**
- *
- * Used internally to enable/disable validation of the channel endpoint that a
- * message for a destination arrived over.
- */
- String VALIDATE_ENDPOINT_HEADER = "DSValidateEndpoint";
-
- /**
- * A message can have a priority header with a 0-9 numerical value (0 being lowest)
- * and the server can choose to use this numerical value to prioritize messages to clients.
- */
- String PRIORITY_HEADER = "DSPriority";
-
- /**
- * The default priority value for messages.
- */
- int DEFAULT_PRIORITY = 4;
-
- /**
- * The name for the header where remote credentials will be passed.
- */
- String REMOTE_CREDENTIALS_HEADER = "DSRemoteCredentials";
-
- /**
- * The name of the header that reports which character set encoding was
- * used to create remote credentials.
- */
- String REMOTE_CREDENTIALS_CHARSET_HEADER = "DSRemoteCredentialsCharset";
-
- /**
- * Messages sent with a defined request timeout use this header.
- * The request timeout value is set on outbound messages by services or
- * channels and the value controls how long the corresponding MessageResponder
- * will wait for an acknowledgement, result or fault response for the message
- * before timing out the request.
- */
- String REQUEST_TIMEOUT_MILLIS_HEADER = "DSRequestTimeoutMillis";
-
- /**
- * Presence of param means that auto-sync is false for the destination.
- */
- String SYNC_HEADER = "sync";
-
- /**
- * A status code can provide context about the nature of a response
- * message. For example, messages received from an HTTP based channel may
- * need to report the HTTP response status code (if available).
- */
- String STATUS_CODE_HEADER = "DSStatusCode";
-
- /**
- * Returns the client id indicating the client that sent the message.
- *
- * @return The client id indicating the client that sent the message.
- */
- Object getClientId();
-
- /**
- * Sets the client id indicating the client that sent the message.
- *
- * @param value The client id to set for the message.
- */
- void setClientId(Object value);
-
- /**
- * Returns the destination that the message targets.
- *
- * @return The destination that the message targets.
- */
- String getDestination();
-
- /**
- * Sets the destination that the message targets.
- *
- * @param value The destination that the message targets.
- */
- void setDestination(String value);
-
- /**
- * Returns the unique message id.
- *
- * @return The unique message id.
- */
- String getMessageId();
-
- /**
- * Sets the unique message id.
- * The id value should be universally unique.
- *
- * @param value The unique message id.
- */
- void setMessageId(String value);
-
- /**
- * Returns the timestamp for the message.
- * Number of milleseconds since the epoch.
- *
- * @return The timestamp for the message.
- */
- long getTimestamp();
-
- /**
- * Sets the timestamp for the message.
- * Number of milliseconds since the epoch.
- *
- * @param value The timestamp for the message.
- */
- void setTimestamp(long value);
-
- /**
- * Returns the time to live for the message. This is the number of
- * milliseconds beyond the message timestamp that the message is
- * considered valid and deliverable.
- *
- * @return The time to live for the message.
- */
- long getTimeToLive();
-
- /**
- * Sets the time to live for the message. This is the number of milliseconds
- * beyond the message timestamp that the message will be considered valid and
- * deliverable.
- *
- * @param value The time to live for the message.
- */
- void setTimeToLive(long value);
-
- /**
- * Returns the body of the message.
- *
- * @return The body of the message.
- */
- Object getBody();
-
- /**
- * Sets the body of the message.
- *
- * @param value The body of the message.
- */
- void setBody(Object value);
-
- /**
- * Returns the headers for the message.
- *
- * @return The headers for the message.
- */
- Map getHeaders();
-
- /**
- * Sets the headers for the message.
- *
- * @param value The headers to set on the message.
- */
- void setHeaders(Map value);
-
- /**
- * Returns a header value corresponding to the passed header name.
- * If no header with this name exists, <code>null</code> is returned.
- *
- * @param name The header name to retrieve a value for.
- * @return The header value.
- */
- Object getHeader(String name);
-
- /**
- * Sets a header on the message.
- *
- * @param name The name of the header to set.
- * @param value The value for the header.
- */
- void setHeader(String name, Object value);
-
- /**
- * Tests whether a header with the passed name exists.
- *
- * @param name The header to test for existence.
- * @return <code>true</code> if the headers exists; otherwise <code>false</code>.
- */
- boolean headerExists(String name);
-
- /**
- * Returns a clone of the message.
- *
- * @return A clone of the message.
- */
- Object clone();
-}
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/flex/messaging/messages/MessagePerformanceInfo.java
----------------------------------------------------------------------
diff --git a/core/src/flex/messaging/messages/MessagePerformanceInfo.java b/core/src/flex/messaging/messages/MessagePerformanceInfo.java
deleted file mode 100644
index e61545e..0000000
--- a/core/src/flex/messaging/messages/MessagePerformanceInfo.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package flex.messaging.messages;
-
-import java.io.Serializable;
-
-/**
- *
- *
- * The MessagePerformanceInfo class is used to capture various metrics about
- * the sizing and timing of a message sent from a client to the server and its
- * response message, as well as pushed messages from the server to the client.
- * A response message should have two instances of this class among its headers,
- * headers[MPII] - info for the client to server message,
- * headers[MPIO] - info for the response message from server to client.
- * A pushed message will have an extra headers and its headers will represent,
- * headers[MPII] - info for the client to server message poll message (non RTMP)
- * headers[MPIO] - info for the pushed message from server to client,
- * headers[MPIP] - info for the message from the client that caused the push message
- *
- * It has a symmetric AS counterpart - MessagePerformanceInfo.as
- */
-public class MessagePerformanceInfo implements Serializable, Cloneable
-{
- private static final long serialVersionUID = -8556484221291213962L;
-
- /**
- *
- *
- * Size of message in Bytes (message types depends on what header this MPI is in)
- */
- public long messageSize;
-
- /**
- *
- *
- * Millisecond timestamp of when this message was sent
- * (origin depends on on what header this MPI is in)
- */
- public long sendTime;
-
- /**
- *
- *
- * Millisecond timestamp of when this message was received
- * (destination depends on on what header this MPI is in)
- */
- public long receiveTime;
-
- /**
- *
- *
- * Amount of time in milliseconds that this message was being processed on the server
- * in order to calculate and populate MPI metrics
- */
- public long overheadTime;
-
- /**
- *
- *
- * "OUT" when this message originated on the server
- */
- public String infoType;
-
- /**
- *
- *
- * True if this is info for a message that was pushed from server to client
- */
- public boolean pushedFlag;
-
- /**
- *
- *
- * Flag is true when record-message-sizes is enabled for the communication channel
- */
- public boolean recordMessageSizes;
-
- /**
- *
- *
- * Flag is true when record-message-times is enabled for the communication channel
- */
- public boolean recordMessageTimes;
-
- /**
- *
- *
- * Millisecond timestamp of when the server became ready to push this message out
- * to clients
- */
- public long serverPrePushTime;
-
- /**
- *
- *
- * Millisecond timestamp of when the server called into the adapter associated with the
- * destination of this message
- */
- public long serverPreAdapterTime;
-
- /**
- *
- *
- * Millisecond timestamp of when server processing returned from the adapater associated
- * with the destination of this message
- */
- public long serverPostAdapterTime;
-
- /**
- *
- *
- * Millisecond timestamp of when the adapter associated with the destination of this message
- * made a call to an external component (for example a JMS server)
- */
- public long serverPreAdapterExternalTime;
-
- /**
- *
- *
- * Millisecond timestamp of when processing came back to the adapter associated with the destination
- * of this message from a call to an external component (for example a JMS server)
- */
- public long serverPostAdapterExternalTime;
-
- /**
- *
- *
- * Copies the immutable fields of this MPI isntance over to create a new one
- * @return cloned instance of this MessagePerformanceInfo instance
- */
- public Object clone()
- {
- try
- {
- return super.clone();
- }
- catch (CloneNotSupportedException e)
- {
- // This cannot happen since the super class is Object but since
- // the exception has to be caught anyway, code is left in
- MessagePerformanceInfo mpii = new MessagePerformanceInfo();
- mpii.messageSize = this.messageSize;
- mpii.sendTime = this.sendTime;
- mpii.receiveTime = this.receiveTime;
- mpii.overheadTime = this.overheadTime;
- mpii.serverPrePushTime = this.serverPrePushTime;
- mpii.serverPreAdapterTime = this.serverPreAdapterTime;
- mpii.serverPostAdapterTime = this.serverPostAdapterTime;
- mpii.serverPreAdapterExternalTime = this.serverPreAdapterExternalTime;
- mpii.serverPostAdapterExternalTime = this.serverPostAdapterExternalTime;
- mpii.recordMessageSizes = this.recordMessageSizes;
- mpii.recordMessageTimes = this.recordMessageTimes;
- return mpii;
- }
-
- }
-
- /**
- *
- *
- * Increase the overhead counter for this MPI
- * @param overhead Increment size in milliseconds
- */
- public void addToOverhead(long overhead)
- {
- overheadTime += overhead;
- }
-
- /**
- *
- *
- * Default constructor
- */
- public MessagePerformanceInfo()
- {
-
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/flex/messaging/messages/MessagePerformanceUtils.java
----------------------------------------------------------------------
diff --git a/core/src/flex/messaging/messages/MessagePerformanceUtils.java b/core/src/flex/messaging/messages/MessagePerformanceUtils.java
deleted file mode 100644
index bc7421d..0000000
--- a/core/src/flex/messaging/messages/MessagePerformanceUtils.java
+++ /dev/null
@@ -1,415 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package flex.messaging.messages;
-
-import flex.messaging.FlexContext;
-import flex.messaging.endpoints.AbstractEndpoint;
-import flex.messaging.io.amf.ActionContext;
-import flex.messaging.log.Log;
-import flex.messaging.log.LogCategories;
-
-/**
- *
- *
- * Utility class for populating MessagePerformanceInformation objects at various stages of
- * server processing. A given message may have three MPI headers populated (naming convention
- * of these headers is from the perspective of the server):
- *
- * DSMPII - incoming message, message sent from client to server
- * DSMPIO - outgoing message, response/acknowledgement message sent from server back to client
- * DSMPIP - only populated for a pushed message, this is information for the incoming message
- * that caused the pushed message
- */
-public class MessagePerformanceUtils
-{
-
- static final String LOG_CATEGORY = LogCategories.MESSAGE_GENERAL;
-
- public static final String MPI_HEADER_IN = "DSMPII";
- public static final String MPI_HEADER_OUT = "DSMPIO";
- public static final String MPI_HEADER_PUSH = "DSMPIP";
-
- public static int MPI_NONE = 0;
- public static int MPI_TIMING = 1;
- public static int MPI_TIMING_AND_SIZING = 2;
-
- /**
- *
- *
- * Clones the MPI object for the incoming message from client to server
- * from the batch wrapper to all messages included in it, keeping track of
- * overhead time spent doing this.
- *
- * @param message The message whose MPI should be propogated
- */
- public static void propogateMPIDownBatch(Message message)
- {
- long overhead = System.currentTimeMillis();
- if(message instanceof BatchableMessage)
- {
- BatchableMessage dm = (BatchableMessage)message;
- if(dm.isBatched())
- {
- Object[] batchedMessages = (Object[])message.getBody();
- int batchedLength = batchedMessages.length;
- for(int a=0;a<batchedLength;a++)
- {
- Message currentMess = (Message)batchedMessages[a];
- MessagePerformanceInfo mpi = MessagePerformanceUtils.getMPII(message);
- MessagePerformanceUtils.setMPII(currentMess, (MessagePerformanceInfo)mpi.clone());
- propogateMPIDownBatch(currentMess);
- }
- }
- }
- overhead = System.currentTimeMillis() - overhead;
- MessagePerformanceUtils.getMPII(message).addToOverhead(overhead);
- }
-
- /**
- *
- *
- * This method finalizes the incoming MPI instance. It is necessary because the client
- * send time is stored on the incoming MPII and the server receive time as well as message
- * size are populated in the MPI object stored on the ActionContext, this method combines
- * the information into one MPI instance.
- *
- * @param context - The action context used to deserialize the incoming message, it will have the
- * server receive time and message size information
- * @param inMessage - The incoming message, its MPI will have the client send time
- */
- public static void setupMPII(ActionContext context, Message inMessage)
- {
- try
- {
- // the MPI from the incoming message will have the client-send timestamp
- MessagePerformanceInfo mpii= MessagePerformanceUtils.getMPII(inMessage);
-
- // this is the MPI that we want to propogate
- MessagePerformanceInfo contextMPI = context.getMPII();
- if(contextMPI!=null && mpii!=null){
- contextMPI.sendTime = mpii.sendTime;
- MessagePerformanceUtils.setMPII(inMessage, (MessagePerformanceInfo)contextMPI.clone());
- propogateMPIDownBatch(inMessage);
- }
- }
- catch(Exception e)
- {
- if (Log.isDebug())
- Log.getLogger(LOG_CATEGORY).error("MPI error: setting up response MPI : " +
- e.toString());
- }
- }
-
- /**
- *
- *
- * This method sets up the outgoing MPI object for a response/acknowledgement message.
- * The outgoing message should also have a copy of the incoming MPI so that when the client
- * receives the response it has access to all information
- *
- * @param context - The context used to deserialize the incoming message
- * @param inMessage - The incoming message
- * @param outMessage - The response message
- */
- public static void updateOutgoingMPI(ActionContext context, Message inMessage, Object outMessage)
- {
- try
- {
- MessagePerformanceInfo mpio=null;
- if(context != null)
- {
- mpio = context.getMPIO();
- if(mpio == null)
- {
- mpio = new MessagePerformanceInfo();
- if(MessagePerformanceUtils.getMPII(inMessage)!=null && MessagePerformanceUtils.getMPII(inMessage).sendTime!=0)
- mpio.infoType="OUT";
- }
- Message mess = (Message)outMessage;
- if(MessagePerformanceUtils.getMPII(inMessage)!=null)
- MessagePerformanceUtils.setMPII(mess, (MessagePerformanceInfo)MessagePerformanceUtils.getMPII(inMessage).clone());
- MessagePerformanceUtils.setMPIO(mess, mpio);
- context.setMPIO(mpio);
- }
-
- if(outMessage instanceof CommandMessage &&
- ((CommandMessage)outMessage).getOperation() == CommandMessage.CLIENT_SYNC_OPERATION)
- {
- // pushed message case
- CommandMessage cmd = (CommandMessage)outMessage;
- Object[] cmdBody = (Object[])cmd.getBody();
- // in the pushed message case we want the outgoing metrics of the message to be updated
- // however, we want the incoming metrics to be that of the poll message and
- // the incoming push metrics to be that of the original message
- int batchedLength = cmdBody.length;
- for(int i = 0; i < batchedLength; i++)
- {
- Message currentMess = (Message)cmdBody[i];
- MessagePerformanceInfo origMPII = MessagePerformanceUtils.getMPII(currentMess);
-
- if (origMPII == null || MessagePerformanceUtils.getMPII(inMessage) == null)
- {
- // this can happen if the server has MPI enabled but the producing client does not
- // log a warning for this and break out of here as MPI requires all participating
- // parties to have the same settings
- if (Log.isError())
- {
- Log.getLogger(LOG_CATEGORY).error
- (
- "MPI is enabled but could not get message performance information " +
- "for incoming MPI instance from client message. The client "+
- "might have created a new channel not configured to send message" +
- " performance after declaring a different destination which does." +
- " The client channel should either be configured to add MPI " +
- "properties, or a server destion which has the same MPI " +
- "properties as the client channel should be used.");
- }
- return;
- }
-
- MessagePerformanceUtils.setMPIP(currentMess, (MessagePerformanceInfo)origMPII.clone());
- MessagePerformanceInfo newMPII = (MessagePerformanceInfo)MessagePerformanceUtils.getMPII(inMessage).clone();
- mpio.pushedFlag=true;
- MessagePerformanceUtils.setMPII(currentMess, newMPII);
- MessagePerformanceUtils.setMPIO(currentMess, mpio);
- }
- }
- }
- catch(Exception e)
- {
- if (Log.isDebug())
- Log.getLogger(LOG_CATEGORY).error("MPI error: setting up response MPI : " +
- e.toString());
- }
- }
-
- /**
- *
- *
- * Convenience method for setting the incoming MPI object on a message.
- *
- * @param message The message whose MPI header will be set
- * @param mpi The incoming MPI instance
- */
- public static void setMPII(Message message, MessagePerformanceInfo mpi)
- {
- message.setHeader(MPI_HEADER_IN, mpi);
- }
-
- /**
- *
- * The server generated messages do not have MPII object (which is normally set
- * by the client) which prevents the usual performance gathering. This convenience method
- * can be invoked to set the MPII object (as if it's generated by the client) once the
- * message is generated on the server but before it is routed to the MessageBroker
- * to be delivered to the client. This way performance gathering can proceed as expected.
- *
- * @param message The server generated message.
- */
- public static void setMPIIForServerGeneratedMessage(Message message)
- {
- MessagePerformanceInfo mpii = new MessagePerformanceInfo();
- AbstractEndpoint endpoint = (AbstractEndpoint)FlexContext.getEndpoint();
- mpii.recordMessageSizes = endpoint != null? endpoint.isRecordMessageSizes() : false;
- mpii.recordMessageTimes = endpoint != null? endpoint.isRecordMessageTimes() : false;
- mpii.sendTime = System.currentTimeMillis();
- MessagePerformanceUtils.setMPII(message, mpii);
- }
-
- /**
- *
- *
- * Convenience method for setting the outgoing MPI object on a message.
- *
- * @param message The message whose MPI header will be set
- * @param mpi The outgoing MPI instance
- */
- public static void setMPIO(Message message, MessagePerformanceInfo mpi)
- {
- message.setHeader(MPI_HEADER_OUT, mpi);
- }
-
- /**
- *
- *
- * Convenience method for setting the pushed MPI object on a message.
- *
- * @param message The message whose MPI header will be set
- * @param mpi The pushed MPI instance (this is the incoming MPI instance
- * of the message that caused the push)
- */
- public static void setMPIP(Message message, MessagePerformanceInfo mpi)
- {
- message.setHeader(MPI_HEADER_PUSH, mpi);
- }
-
- /**
- *
- *
- * Convenience method for retrieving the incoming MPI object from a message.
- *
- * @param message The message whose MPI header will be retrieved
- * @return mpi Incoming MPI instance
- */
- public static MessagePerformanceInfo getMPII(Message message)
- {
- return (MessagePerformanceInfo)message.getHeader(MPI_HEADER_IN);
- }
-
- /**
- *
- *
- * Convenience method for retrieving the outgoing MPI object from a message.
- *
- * @param message The message whose MPI header will be retrieved
- * @return mpi Outgoing MPI instance
- */
- public static MessagePerformanceInfo getMPIO(Message message)
- {
- return (MessagePerformanceInfo)message.getHeader(MPI_HEADER_OUT);
- }
-
- /**
- *
- *
- * Convenience method for retrieving the pushed MPI object from a message.
- *
- * @param message The message whose MPI header will be retrieved
- * @return mpi Pushed MPI instance (this is the incoming MPI instance
- * of the message that caused the push)
- */
- public static MessagePerformanceInfo getMPIP(Message message)
- {
- return (MessagePerformanceInfo)message.getHeader(MPI_HEADER_PUSH);
- }
-
- /**
- *
- *
- * Convenience method for setting server pre-push processing time on a message.
- * No-op if record-message-times is false
- *
- * @param message The message whose MPI header will be updated
- */
- public static void markServerPrePushTime(Message message)
- {
- // If the message does not have an MPI header then we are not recording message times
- // and we have nothing to do here
- if (getMPII(message) == null || getMPII(message).sendTime == 0)
- return;
-
- MessagePerformanceInfo mpi = getMPII(message);
- mpi.serverPrePushTime = System.currentTimeMillis();
- }
-
- /**
- *
- *
- * Convenience method for setting server pre-adapter timestamp on a message.
- * No-op if record-message-times is false
- *
- * @param message The message whose MPI header will be updated
- */
- public static void markServerPreAdapterTime(Message message)
- {
- // If the message does not have an MPI header then we are not recording message times
- // and we have nothing to do here
- if (getMPII(message) == null || getMPII(message).sendTime == 0)
- return;
-
- MessagePerformanceInfo mpi = getMPII(message);
-
- // it is possible that a batched message will have this called multiple times,
- // do not reset stamp once it has been set
- if (mpi.serverPreAdapterTime != 0)
- return;
-
- mpi.serverPreAdapterTime = System.currentTimeMillis();
- }
-
- /**
- *
- *
- * Convenience method for setting server post-adapter timestamp on a message.
- * No-op if record-message-times is false
- *
- * @param message The message whose MPI header will be updated
- */
- public static void markServerPostAdapterTime(Message message)
- {
- // If the message does not have an MPI header then we are not recording message times
- // and we have nothing to do here
- if (getMPII(message) == null || getMPII(message).sendTime == 0 || getMPII(message).serverPostAdapterTime != 0)
- return;
-
- MessagePerformanceInfo mpi = getMPII(message);
- mpi.serverPostAdapterTime = System.currentTimeMillis();
- }
-
- /**
- *
- * Method may be called from a custom adapter to mark the beginning of processing that occurs
- * outside of the adapter for a particular message. Use this method in conjunction with
- * <code>markServerPostAdapterExternalTime</code> to mark the amount of time spent when your
- * adapter must make a call to an external component. If <code>record-message-times</code> is
- * <code>true</code> for the communication channel, the server processing time external to the
- * adapter may be retrieved via MessagePerformanceUtils.serverAdapterExternalTime on the client
- * once it receives the message.
- *
- * If <code>record-message-times</code> is <code>false</code> for the communication channel,
- * calling this method will have no effect.
- *
- * @param message The message being processed
- */
- public static void markServerPreAdapterExternalTime(Message message)
- {
- // If the message does not have an MPI header then we are not recording message times
- // and we have nothing to do here
- if (getMPII(message) == null || getMPII(message).sendTime == 0)
- return;
-
- MessagePerformanceInfo mpi = getMPII(message);
- mpi.serverPreAdapterExternalTime = System.currentTimeMillis();
- }
-
- /**
- *
- * Method may be called from a custom adapter to mark the end of processing that occurs
- * outside of the adapter for a particular message. Use this method in conjunction with
- * <code>markServerPreAdapterExternalTime</code> to mark the amount of time spent when your
- * adapter must make a call to an external component. If <code>record-message-times</code> is
- * <code>true</code> for the communication channel, the server processing time external to the
- * adapter may be retrieved via MessagePerformanceUtils.serverAdapterExternalTime on the client
- * once it receives the message.
- *
- * If <code>record-message-times</code> is <code>false</code> for the communication channel,
- * calling this method will have no effect.
- *
- * @param message The message being processed
- */
- public static void markServerPostAdapterExternalTime(Message message)
- {
- // If the message does not have an MPI header then we are not recording message times
- // and we have nothing to do here
- if (getMPII(message) == null || getMPII(message).sendTime == 0 || getMPII(message).serverPostAdapterExternalTime != 0)
- return;
-
- MessagePerformanceInfo mpi = getMPII(message);
- mpi.serverPostAdapterExternalTime = System.currentTimeMillis();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/flex/messaging/messages/RPCMessage.java
----------------------------------------------------------------------
diff --git a/core/src/flex/messaging/messages/RPCMessage.java b/core/src/flex/messaging/messages/RPCMessage.java
deleted file mode 100644
index 2f7711a..0000000
--- a/core/src/flex/messaging/messages/RPCMessage.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package flex.messaging.messages;
-
-import flex.messaging.log.LogCategories;
-import flex.messaging.log.Log;
-
-/**
- * Base class for RPC request-styled messages, such as RemotingMessage,
- * HTTPMessage and SOAPMessage.
- *
- *
- */
-public abstract class RPCMessage extends AbstractMessage
-{
- /**
- * This number was generated using the 'serialver' command line tool.
- * This number should remain consistent with the version used by
- * ColdFusion to communicate with the message broker over RMI.
- */
- private static final long serialVersionUID = -1203255926746881424L;
-
- private String remoteUsername;
- private String remotePassword;
-
- public RPCMessage()
- {
- }
-
- public String getRemoteUsername()
- {
- return remoteUsername;
- }
-
- public void setRemoteUsername(String s)
- {
- remoteUsername = s;
- }
-
- public String getRemotePassword()
- {
- return remotePassword;
- }
-
- public void setRemotePassword(String s)
- {
- remotePassword = s;
- }
-
- protected String toStringFields(int indentLevel)
- {
- String sp = super.toStringFields(indentLevel);
- String sep = getFieldSeparator(indentLevel);
- StringBuilder sb = new StringBuilder();
- sb.append(sep).append("clientId = ").append(Log.isExcludedProperty("clientId") ? Log.VALUE_SUPRESSED : clientId);
- sb.append(sep).append("destination = ").append(Log.isExcludedProperty("destination") ? Log.VALUE_SUPRESSED : destination);
- sb.append(sep).append("messageId = ").append(Log.isExcludedProperty("messageId") ? Log.VALUE_SUPRESSED : messageId);
- sb.append(sep).append("timestamp = ").append(Log.isExcludedProperty("timestamp") ? Log.VALUE_SUPRESSED : String.valueOf(timestamp));
- sb.append(sep).append("timeToLive = ").append(Log.isExcludedProperty("timeToLive") ? Log.VALUE_SUPRESSED : String.valueOf(timeToLive));
- sb.append(sep).append("body = ").append(Log.isExcludedProperty("body") ? Log.VALUE_SUPRESSED : bodyToString(getBody(), indentLevel) + sp);
- return sb.toString();
- }
-
- public String logCategory()
- {
- return LogCategories.MESSAGE_RPC;
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/flex/messaging/messages/RemotingMessage.java
----------------------------------------------------------------------
diff --git a/core/src/flex/messaging/messages/RemotingMessage.java b/core/src/flex/messaging/messages/RemotingMessage.java
deleted file mode 100644
index 567f8f6..0000000
--- a/core/src/flex/messaging/messages/RemotingMessage.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package flex.messaging.messages;
-
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * This type of message contains information needed to perform
- * a Remoting invocation. Some of this information mirrors that
- * of the gateway's ActionContext, but the context itself cannot
- * be used as the message, because it is available only from the
- * AMF Endpoint and not to other endpoints (the RTMP Endpoint has
- * no HTTP, and therefore cannot support the request/response and
- * session properties of the ActionContext).
- *
- *
- */
-public class RemotingMessage extends RPCMessage
-{
- /**
- * This number was generated using the 'serialver' command line tool.
- * This number should remain consistent with the version used by
- * ColdFusion to communicate with the message broker over RMI.
- */
- private static final long serialVersionUID = 1491092800943415719L;
-
- private String source;
- private String operation;
- private Object[] parameters;
- private transient List parameterList;
-
- public RemotingMessage()
- {
- }
-
- public String getSource()
- {
- return source;
- }
-
- public void setSource(String s)
- {
- source = s;
- }
-
- public Object getBody()
- {
- if (parameters == null && parameterList != null)
- return parameterList.toArray();
- else
- return parameters;
- }
-
- public void setBody(Object bodyValue)
- {
- if (bodyValue instanceof List)
- {
- // some channels/endpoints may send in a list
- // and expect to keep a reference to it - amfx
- // for example works this way, so keep the list
- // around rather than making an array copy
- if (parameterList != null)
- {
- parameterList.addAll((List) bodyValue);
- }
- else
- {
- parameterList = (List) bodyValue;
- }
- }
- else if (!bodyValue.getClass().isArray())
- {
- parameters = new Object[] { bodyValue };
- }
- else
- {
- parameters = (Object[]) bodyValue;
- }
- }
-
- public String getOperation()
- {
- return operation;
- }
-
- public void setOperation(String operation)
- {
- this.operation = operation;
- }
-
- public List getParameters()
- {
- if (parameters == null && parameterList != null)
- {
- parameters = parameterList.toArray();
- // we can clean up the parameter list now
- parameterList = null;
- }
- return (parameters == null) ? null : Arrays.asList(parameters);
- }
-
- public void setParameters(List params)
- {
- parameters = params.toArray();
- }
-
- protected String toStringFields(int indentLevel)
- {
- String s = getOperation();
- String sp = super.toStringFields(indentLevel);
- String sep = getFieldSeparator(indentLevel);
- //parameters will be showing up as in the body (getBody() is used in super.toStringField())
- //so we will skip parameters here
- return sep + "operation = " + s + sp;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/flex/messaging/messages/SOAPMessage.java
----------------------------------------------------------------------
diff --git a/core/src/flex/messaging/messages/SOAPMessage.java b/core/src/flex/messaging/messages/SOAPMessage.java
deleted file mode 100644
index a291ab2..0000000
--- a/core/src/flex/messaging/messages/SOAPMessage.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package flex.messaging.messages;
-
-import flex.messaging.io.MessageIOConstants;
-
-/**
- * A SOAP specific subclass of HTTPMessage. By default we
- * assume the content-type as "text/xml; charset=utf-8"
- * and the HTTP method will be POST.
- *
- *
- */
-public class SOAPMessage extends HTTPMessage
-{
- /**
- * This number was generated using the 'serialver' command line tool.
- * This number should remain consistent with the version used by
- * ColdFusion to communicate with the message broker over RMI.
- */
- private static final long serialVersionUID = 3706466843618325314L;
-
- public SOAPMessage()
- {
- contentType = MessageIOConstants.CONTENT_TYPE_XML;
- method = MessageIOConstants.METHOD_POST;
- }
-
- public String getAction()
- {
- Object action = httpHeaders.get(MessageIOConstants.HEADER_SOAP_ACTION);
- return action == null ? null : action.toString();
- }
-
- public void setAction(String action)
- {
- httpHeaders.put(MessageIOConstants.HEADER_SOAP_ACTION, action);
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/flex/messaging/messages/SmallMessage.java
----------------------------------------------------------------------
diff --git a/core/src/flex/messaging/messages/SmallMessage.java b/core/src/flex/messaging/messages/SmallMessage.java
deleted file mode 100644
index d757160..0000000
--- a/core/src/flex/messaging/messages/SmallMessage.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package flex.messaging.messages;
-
-/**
- * A marker interface that is used to indicate that a Message has an
- * alternative smaller form for serialization.
- *
- */
-public interface SmallMessage extends Message
-{
- /**
- * This method must be implemented by subclasses that have an
- * <code>java.io.Externalizable</code> or "small" form, or null to
- * indicate that a small form is not available.
- *
- * @return An alternative representation of a
- * flex.messaging.messages.Message so that the size of the serialized
- * message is smaller.
- */
- Message getSmallMessage();
-}
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/flex/messaging/messages/package-info.java
----------------------------------------------------------------------
diff --git a/core/src/flex/messaging/messages/package-info.java b/core/src/flex/messaging/messages/package-info.java
deleted file mode 100644
index e6cd30c..0000000
--- a/core/src/flex/messaging/messages/package-info.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package flex.messaging.messages;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/flex/messaging/package-info.java
----------------------------------------------------------------------
diff --git a/core/src/flex/messaging/package-info.java b/core/src/flex/messaging/package-info.java
deleted file mode 100644
index 748d816..0000000
--- a/core/src/flex/messaging/package-info.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package flex.messaging;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/flex/messaging/security/AppServerLoginCommand.java
----------------------------------------------------------------------
diff --git a/core/src/flex/messaging/security/AppServerLoginCommand.java b/core/src/flex/messaging/security/AppServerLoginCommand.java
deleted file mode 100644
index 864623a..0000000
--- a/core/src/flex/messaging/security/AppServerLoginCommand.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package flex.messaging.security;
-
-import java.security.Principal;
-import java.util.List;
-import java.util.Map;
-
-import javax.servlet.ServletConfig;
-import javax.servlet.http.HttpServletRequest;
-
-import flex.messaging.FlexContext;
-import flex.messaging.io.MessageIOConstants;
-
-/**
- * This class implements LoginCommand and doAuthorization in way that should work by default if
- * authorization logged a user into the J2EE application server. doAuthorization uses isUserInRole.
- *
- *
- */
-public abstract class AppServerLoginCommand implements LoginCommand
-{
-
- /**
- * The gateway calls this method to perform programmatic authorization.
- * <p>
- * This implementation will simply iterate over the supplied roles and
- * check that at least one of the roles returned true from a call to
- * HttpServletRequest.isUserInRole(String role).
- * </p>
- *
- * @param principal The principal being checked for authorization
- * @param roles A List of role names to check, all members should be strings
- * @return true if the principal belongs to at least one of the roles
- * @throws SecurityException Throws SecurityException
- */
- public boolean doAuthorization(Principal principal, List roles) throws SecurityException
- {
- HttpServletRequest request = FlexContext.getHttpRequest();
- return (request != null) ? doAuthorization(principal, roles, request) : false;
- }
-
- protected boolean doAuthorization(Principal principal, List roles, HttpServletRequest request)
- throws SecurityException
- {
- for (Object role : roles)
- {
- if (request.isUserInRole((String)role))
- return true;
- }
-
- return false;
- }
-
- protected String extractPassword(Object credentials)
- {
- if (credentials instanceof String)
- return (String)credentials;
- else if (credentials instanceof Map)
- return (String)((Map)credentials).get(MessageIOConstants.SECURITY_CREDENTIALS);
- return null;
- }
-
- /**
- * Called to initialize a login command prior to authentication/authorization requests.
- * The default implementation is no-op but subclasses can override to provide
- * their own implementation.
- *
- * @param config The servlet configuration for MessageBrokerServlet.
- */
- public void start(ServletConfig config)
- {
- // No-op.
- }
-
- /**
- * Called to free up resources used by the login command. The default implementation
- * is no-op, subclasses can override to provide their own implementation.
- */
- public void stop()
- {
- // No-op.
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/8315f8fa/core/src/flex/messaging/security/LoginCommand.java
----------------------------------------------------------------------
diff --git a/core/src/flex/messaging/security/LoginCommand.java b/core/src/flex/messaging/security/LoginCommand.java
deleted file mode 100644
index f29fca7..0000000
--- a/core/src/flex/messaging/security/LoginCommand.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package flex.messaging.security;
-
-import javax.servlet.ServletConfig;
-
-import java.security.Principal;
-import java.util.List;
-
-/**
- * The class name of the implementation of this interface is configured in the
- * gateway configuration's security section and is instantiated using reflection
- * on servlet initialization.
- */
-public interface LoginCommand
-{
- /**
- * Called to initialize a login command prior to authentication/authorization requests.
- *
- * @param config The servlet configuration for MessageBrokerServlet.
- */
- void start(ServletConfig config);
-
- /**
- * Called to free up resources used by the login command.
- */
- void stop();
-
- /**
- * The gateway calls this method to perform programmatic, custom authentication.
- * <p>
- * The credentials are passed as a Map to allow for extra properties to be
- * passed in the future. For now, only a "password" property is sent.
- * </p>
- *
- * @param username The principal being authenticated
- * @param credentials A map, typically with string keys and values - holds, for example, a password
- * @return principal for the authenticated user when authentication is successful; null otherwise
- */
- Principal doAuthentication(String username, Object credentials);
-
- /**
- * The gateway calls this method to perform programmatic authorization.
- * <p>
- * A typical implementation would simply iterate over the supplied roles and
- * check that atleast one of the roles returned true from a call to
- * HttpServletRequest.isUserInRole(String role).
- * </p>
- *
- * @param principal The principal being checked for authorization
- * @param roles A List of role names to check, all members should be strings
- * @return true if the principal is authorized given the list of roles
- */
- boolean doAuthorization(Principal principal, List roles);
-
- /**
- * Attempts to log a user out from their session.
- *
- * NOTE: May not be possible on all application servers.
- * @param principal The principal to logout.
- * @return true when logout is successful
- */
- boolean logout(Principal principal);
-}