Author: shawkins
Date: 2010-03-10 10:44:27 -0500 (Wed, 10 Mar 2010)
New Revision: 1956
Removed:
trunk/client/src/main/java/com/metamatrix/platform/security/api/BasicMetaMatrixPrincipal.java
trunk/client/src/main/java/com/metamatrix/platform/security/api/MetaMatrixSessionState.java
Modified:
trunk/documentation/server-extensions-guide/src/main/docbook/en-US/content/logging.xml
trunk/engine/src/main/java/com/metamatrix/common/queue/StatsCapturingWorkManager.java
trunk/engine/src/main/java/com/metamatrix/common/util/LogConstants.java
trunk/runtime/src/main/java/org/teiid/logging/Log4JUtil.java
trunk/runtime/src/main/java/org/teiid/transport/SSLAwareChannelHandler.java
trunk/runtime/src/main/java/org/teiid/transport/ServerWorkItem.java
trunk/runtime/src/main/java/org/teiid/transport/SocketClientInstance.java
trunk/runtime/src/main/java/org/teiid/transport/SocketListener.java
trunk/runtime/src/main/java/org/teiid/transport/SocketTransport.java
Log:
TEIID-1012 changing server context to transport.
Deleted:
trunk/client/src/main/java/com/metamatrix/platform/security/api/BasicMetaMatrixPrincipal.java
===================================================================
---
trunk/client/src/main/java/com/metamatrix/platform/security/api/BasicMetaMatrixPrincipal.java 2010-03-10
02:34:03 UTC (rev 1955)
+++
trunk/client/src/main/java/com/metamatrix/platform/security/api/BasicMetaMatrixPrincipal.java 2010-03-10
15:44:27 UTC (rev 1956)
@@ -1,201 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library 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 library 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.platform.security.api;
-
-import java.io.Serializable;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
-import com.metamatrix.admin.api.exception.security.InvalidSessionException;
-import com.metamatrix.core.CorePlugin;
-import com.metamatrix.core.ErrorMessageKeys;
-
-public class BasicMetaMatrixPrincipal implements MetaMatrixPrincipal, Serializable {
- private static final long serialVersionUID = -3458004182869226507L;
- private int type;
- private String name;
- private Set unmodifiableGroupNames;
-
- /**
- * Create a <code>BasicMetaMatrixPrincipal</code> with all attributes
required for
- * display in the MetaMatrix Console.
- *
- * @param name the name of the principal.
- * @param type the principal type (user or group) see {@link MetaMatrixPrincipal}.
- * @param groupNames the memberships to which this principal belongs (explicitly).
- * @param properties the properties that will be displayed in the Console (location,
phone #, etc)
- * for this principal. <b>NOTE:</b> these properties may be
<code>null</code>.
- */
- public BasicMetaMatrixPrincipal( String name, int type, Set groupNames) {
- if ( name == null || name.trim().length() == 0 ) {
- throw new
IllegalArgumentException(CorePlugin.Util.getString(ErrorMessageKeys.SEC_MEMBERSHIP_0013));
- }
- if ( name.trim().length() > NAME_LEN_LIMIT ) {
- throw new
IllegalArgumentException(CorePlugin.Util.getString(ErrorMessageKeys.SEC_MEMBERSHIP_0014,
- NAME_LEN_LIMIT));
- }
- if ( type < TYPE_USER || type > TYPE_ADMIN ) {
- throw new
IllegalArgumentException(CorePlugin.Util.getString(ErrorMessageKeys.SEC_MEMBERSHIP_0015));
- }
- this.name = name;
- this.type = type;
- this.unmodifiableGroupNames = Collections.unmodifiableSet(groupNames);
- }
-
- /**
- * Create a minimal <code>BasicMetaMatrixPrincipal</code>.
- *
- * <p><b>NOTE:</b> For this object to be displayed properly in the
MetaMatrix Console,
- * it's group memberships must be added after creation. This is currently not
exposed.</p>
- *
- * @param name the name of the principal.
- * @param type the principal type (user or group) see {@link MetaMatrixPrincipal}.
- */
- public BasicMetaMatrixPrincipal( String name, int type ) {
- this(name,type,Collections.EMPTY_SET);
- }
-
- /**
- * Copy CTOR.
- * @param obj the object to copy
- */
- protected BasicMetaMatrixPrincipal( BasicMetaMatrixPrincipal obj ) {
- if ( obj == null ) {
- throw new
IllegalArgumentException(CorePlugin.Util.getString(ErrorMessageKeys.SEC_MEMBERSHIP_0016));
- }
- this.type = obj.getType();
- this.name = obj.getName();
- this.unmodifiableGroupNames = Collections.unmodifiableSet(obj.getGroupNames());
- }
-
- /**
- * Get the <code>MetaMatrixPrincipalName</code> for this principal.
- * @see MetaMatrixPrincipaName.
- * @return the <code>MetaMatrixPrincipalName</code> for this principal.
- */
- public MetaMatrixPrincipalName getMetaMatrixPrincipalName() {
- return new MetaMatrixPrincipalName(this.name, this.type);
- }
-
- /**
- * Returns the Principal for each group that this principal is a member of.
- */
- public Set getGroupNames(){
- return unmodifiableGroupNames;
- }
-
- public boolean equals(Object par1){
- boolean result = false;
- if( this == par1){
- return true;
- }
- if( par1 instanceof BasicMetaMatrixPrincipal){
- if( this.type == ((BasicMetaMatrixPrincipal)par1).getType()){
- if(this.name.compareTo(((BasicMetaMatrixPrincipal)par1).getName()) ==
0){
- result = true;
- }
- }
- }
- return result;
- }
-
- /**
- * Get the type of principal
- * @return the type for this principal
- */
- public int getType() {
- return type;
- }
-
- /**
- * Get the String form for the type of principal
- * @return the type for this principal as a String
- */
- public String getTypeLabel() {
- return ( TYPE_NAMES[this.type] );
- }
-
- /**
- * Returns the name of this principal.
- * @return the name of this principal (never null)
- */
- public String getName(){
- return name;
- }
- public int hashCode(){
- return name.hashCode();
- }
- public String toString(){
- StringBuffer sb = new StringBuffer();
- sb.append("Name=\""); //$NON-NLS-1$
- sb.append(this.getName());
- sb.append("\", Type="); //$NON-NLS-1$
- sb.append( TYPE_NAMES[this.type] );
- sb.append(", Groups="); //$NON-NLS-1$
- sb.append(getGroupNames());
- return sb.toString();
- }
-
- /**
- * Return a cloned instance of this object.
- * @return the object that is the clone of this instance.
- */
- public Object clone() {
- return new BasicMetaMatrixPrincipal(this);
- }
-
- /**
- * Merge all of the attributes of the input principal into the target
- * principal. This method returns a new instance that is the merged
- * result.
- * @param p1 the first principal that is to be merged
- * @param p2 the second principal that is to be merged
- * @return the new MetaMatrixPrincipal instance that is the result of the merge.
- * @throws InvalidMetaMatrixSessionException if the two input MetaMatrixPrincipal
- * instances do not have the same username.
- * @throws IllegalArgumentException if either of the two input principals
- * are null.
- */
- public static MetaMatrixPrincipal merge( MetaMatrixPrincipal p1, MetaMatrixPrincipal
p2 )
- throws InvalidSessionException {
- if ( p1 == null || p2 == null ) {
- throw new
IllegalArgumentException(CorePlugin.Util.getString(ErrorMessageKeys.SEC_MEMBERSHIP_0017));
- }
- if ( p1.getType() != p2.getType() ) {
- throw new
IllegalArgumentException(CorePlugin.Util.getString(ErrorMessageKeys.SEC_MEMBERSHIP_0018,
TYPE_NAMES[p1.getType()], TYPE_NAMES[p2.getType()]));
- }
-
- if ( ! p1.getName().equals( p2.getName() ) ) {
- throw new InvalidSessionException(ErrorMessageKeys.SEC_MEMBERSHIP_0019,
CorePlugin.Util.getString(ErrorMessageKeys.SEC_MEMBERSHIP_0019, p1.getName(),
- p2.getName() ));
- }
-
- Set groups = new HashSet( p1.getGroupNames() );
- groups.addAll( p2.getGroupNames() );
-
- return new BasicMetaMatrixPrincipal( p1.getName(), p1.getType(), groups );
- }
-
-}
-
Deleted:
trunk/client/src/main/java/com/metamatrix/platform/security/api/MetaMatrixSessionState.java
===================================================================
---
trunk/client/src/main/java/com/metamatrix/platform/security/api/MetaMatrixSessionState.java 2010-03-10
02:34:03 UTC (rev 1955)
+++
trunk/client/src/main/java/com/metamatrix/platform/security/api/MetaMatrixSessionState.java 2010-03-10
15:44:27 UTC (rev 1956)
@@ -1,57 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library 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 library 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.platform.security.api;
-
-/**
- * This interface contains the class constants indicating state for a
- *MetaMatrix Session.
- */
-public interface MetaMatrixSessionState {
-
- /**
- * The session is open (active).
- */
- public static final int ACTIVE = 1;
-
- /**
- * The session is closed - this state cannot change once it
- *is reached.
- */
- public static final int CLOSED = 3;
-
- /**
- * The session has expired - this state cannot change once it
- *is reached.
- */
- public static final int EXPIRED = 4;
-
- /**
- * The session is terminated - this state cannot change once it
- *is reached.
- */
- public static final int TERMINATED = 5;
-
-}
-
-
-
Modified:
trunk/documentation/server-extensions-guide/src/main/docbook/en-US/content/logging.xml
===================================================================
---
trunk/documentation/server-extensions-guide/src/main/docbook/en-US/content/logging.xml 2010-03-10
02:34:03 UTC (rev 1955)
+++
trunk/documentation/server-extensions-guide/src/main/docbook/en-US/content/logging.xml 2010-03-10
15:44:27 UTC (rev 1956)
@@ -28,7 +28,7 @@
are more specific contexts depending on the functional area of the
system. Note that logs originating from third-party code, including
integrated org.jboss components, will be logged through their
- respective contexts. See the table below for information on contexts
+ respective contexts and not through org.teiid. See the table below for information on
contexts
relevant to Teiid. See the container's jboss-log4j.xml for a more
complete listing of logging contexts used in the container.</para>
<informaltable frame="all">
@@ -99,15 +99,22 @@
</row>
<row>
<entry>
- <para>org.teiid.SERVER</para>
+ <para>org.teiid.TRANSPORT</para>
</entry>
<entry>
- <para>Events related to socket transports, pooling, threading,
- etc.</para>
+ <para>Events related to the socket transport.</para>
</entry>
</row>
<row>
<entry>
+ <para>org.teiid.RUNTIME</para>
+ </entry>
+ <entry>
+ <para>Events related to work management and system
start/stop.</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
<para>org.teiid.CONNECTOR</para>
</entry>
<entry>
Modified:
trunk/engine/src/main/java/com/metamatrix/common/queue/StatsCapturingWorkManager.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/common/queue/StatsCapturingWorkManager.java 2010-03-10
02:34:03 UTC (rev 1955)
+++
trunk/engine/src/main/java/com/metamatrix/common/queue/StatsCapturingWorkManager.java 2010-03-10
15:44:27 UTC (rev 1956)
@@ -94,8 +94,8 @@
}
String name = t.getName();
t.setName(name + "_" + poolName + threadCounter.getAndIncrement());
//$NON-NLS-1$
- if (LogManager.isMessageToBeRecorded(LogConstants.CTX_SERVER, MessageLevel.TRACE)) {
- LogManager.logTrace(LogConstants.CTX_SERVER, "Beginning work with virtual
worker", t.getName()); //$NON-NLS-1$
+ if (LogManager.isMessageToBeRecorded(LogConstants.CTX_RUNTIME, MessageLevel.TRACE)) {
+ LogManager.logTrace(LogConstants.CTX_RUNTIME, "Beginning work with virtual
worker", t.getName()); //$NON-NLS-1$
}
boolean success = false;
try {
@@ -139,8 +139,8 @@
private static void handleException(Work work, WorkException e) {
if (work instanceof WorkListener) {
((WorkListener)work).workRejected(new WorkEvent(work, WorkEvent.WORK_REJECTED, work,
new WorkRejectedException(e)));
- } else if (LogManager.isMessageToBeRecorded(LogConstants.CTX_SERVER,
MessageLevel.DETAIL)) {
- LogManager.logDetail(LogConstants.CTX_SERVER, e, "Exception adding work to the
WorkManager"); //$NON-NLS-1$
+ } else if (LogManager.isMessageToBeRecorded(LogConstants.CTX_RUNTIME,
MessageLevel.DETAIL)) {
+ LogManager.logDetail(LogConstants.CTX_RUNTIME, e, "Exception adding work to the
WorkManager"); //$NON-NLS-1$
}
}
@@ -192,7 +192,7 @@
}
if (atMaxThreads) {
if (newMaxQueueSize && maximumPoolSize > 1) {
- LogManager.logWarning(LogConstants.CTX_SERVER,
QueryPlugin.Util.getString("WorkerPool.Max_thread", maximumPoolSize, poolName,
highestQueueSize)); //$NON-NLS-1$
+ LogManager.logWarning(LogConstants.CTX_RUNTIME,
QueryPlugin.Util.getString("WorkerPool.Max_thread", maximumPoolSize, poolName,
highestQueueSize)); //$NON-NLS-1$
}
return;
}
Modified: trunk/engine/src/main/java/com/metamatrix/common/util/LogConstants.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/common/util/LogConstants.java 2010-03-10
02:34:03 UTC (rev 1955)
+++ trunk/engine/src/main/java/com/metamatrix/common/util/LogConstants.java 2010-03-10
15:44:27 UTC (rev 1956)
@@ -29,7 +29,7 @@
public static final String CTX_SESSION = "SESSION"; //$NON-NLS-1$
public static final String CTX_MEMBERSHIP = "MEMBERSHIP"; //$NON-NLS-1$
public static final String CTX_AUTHORIZATION = "AUTHORIZATION"; //$NON-NLS-1$
- public static final String CTX_SERVER= "SERVER"; //$NON-NLS-1$
+ public static final String CTX_TRANSPORT = "TRANSPORT"; //$NON-NLS-1$
public static final String CTX_QUERY_PLANNER = "PLANNER"; //$NON-NLS-1$
public static final String CTX_DQP = "PROCESSOR"; //$NON-NLS-1$
public static final String CTX_CONNECTOR = DefaultConnectorLogger.CTX_CONNECTOR;
Modified: trunk/runtime/src/main/java/org/teiid/logging/Log4JUtil.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/logging/Log4JUtil.java 2010-03-10 02:34:03 UTC
(rev 1955)
+++ trunk/runtime/src/main/java/org/teiid/logging/Log4JUtil.java 2010-03-10 15:44:27 UTC
(rev 1956)
@@ -107,7 +107,7 @@
contexts.add(ROOT_CONTEXT+com.metamatrix.common.util.LogConstants.CTX_SESSION);
contexts.add(ROOT_CONTEXT+com.metamatrix.common.util.LogConstants.CTX_AUTHORIZATION);
contexts.add(ROOT_CONTEXT+com.metamatrix.common.util.LogConstants.CTX_MEMBERSHIP);
- contexts.add(ROOT_CONTEXT+com.metamatrix.common.util.LogConstants.CTX_SERVER);
+ contexts.add(ROOT_CONTEXT+com.metamatrix.common.util.LogConstants.CTX_TRANSPORT);
contexts.add(ROOT_CONTEXT+com.metamatrix.common.util.LogConstants.CTX_ADMIN_API);
contexts.add(ROOT_CONTEXT+com.metamatrix.common.util.LogConstants.CTX_QUERY_PLANNER);
Modified: trunk/runtime/src/main/java/org/teiid/transport/SSLAwareChannelHandler.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/SSLAwareChannelHandler.java 2010-03-10
02:34:03 UTC (rev 1955)
+++ trunk/runtime/src/main/java/org/teiid/transport/SSLAwareChannelHandler.java 2010-03-10
15:44:27 UTC (rev 1956)
@@ -217,7 +217,7 @@
ChannelStateEvent e) throws Exception {
ChannelListener listener = this.listeners.remove(e.getChannel());
if (listener != null) {
- LogManager.logDetail(LogConstants.CTX_SERVER,
CommPlatformPlugin.Util.getString("SSLAwareChannelHandler.channel_closed"));
//$NON-NLS-1$
+ LogManager.logDetail(LogConstants.CTX_TRANSPORT,
CommPlatformPlugin.Util.getString("SSLAwareChannelHandler.channel_closed"));
//$NON-NLS-1$
}
}
Modified: trunk/runtime/src/main/java/org/teiid/transport/ServerWorkItem.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/ServerWorkItem.java 2010-03-10
02:34:03 UTC (rev 1955)
+++ trunk/runtime/src/main/java/org/teiid/transport/ServerWorkItem.java 2010-03-10
15:44:27 UTC (rev 1956)
@@ -136,7 +136,7 @@
private Serializable processException(Throwable e, String context) {
if (context == null) {
- context = LogConstants.CTX_SERVER;
+ context = LogConstants.CTX_TRANSPORT;
}
// Case 5558: Differentiate between system level errors and
// processing errors. Only log system level errors as errors,
Modified: trunk/runtime/src/main/java/org/teiid/transport/SocketClientInstance.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/SocketClientInstance.java 2010-03-10
02:34:03 UTC (rev 1955)
+++ trunk/runtime/src/main/java/org/teiid/transport/SocketClientInstance.java 2010-03-10
15:44:27 UTC (rev 1956)
@@ -71,8 +71,8 @@
}
public void send(Message message, Serializable messageKey) {
- if (LogManager.isMessageToBeRecorded(LogConstants.CTX_SERVER, MessageLevel.DETAIL))
{
- LogManager.logDetail(LogConstants.CTX_SERVER, " message: " +
message + " for request ID:" + messageKey); //$NON-NLS-1$ //$NON-NLS-2$
+ if (LogManager.isMessageToBeRecorded(LogConstants.CTX_TRANSPORT,
MessageLevel.DETAIL)) {
+ LogManager.logDetail(LogConstants.CTX_TRANSPORT, " message: " +
message + " for request ID:" + messageKey); //$NON-NLS-1$ //$NON-NLS-2$
}
message.setMessageKey(messageKey);
objectSocket.write(message);
@@ -86,7 +86,7 @@
}
public void exceptionOccurred(Throwable t) {
- LogManager.logDetail(LogConstants.CTX_SERVER, t, "Unhandled exception, closing
client instance"); //$NON-NLS-1$
+ LogManager.logDetail(LogConstants.CTX_TRANSPORT, t, "Unhandled exception, closing
client instance"); //$NON-NLS-1$
}
public void onConnection() throws CommunicationException {
@@ -135,8 +135,8 @@
}
private void processMessagePacket(Message packet) {
- if (LogManager.isMessageToBeRecorded(LogConstants.CTX_SERVER, MessageLevel.DETAIL)) {
- LogManager.logDetail(LogConstants.CTX_SERVER, "processing message:" +
packet); //$NON-NLS-1$
+ if (LogManager.isMessageToBeRecorded(LogConstants.CTX_TRANSPORT, MessageLevel.DETAIL))
{
+ LogManager.logDetail(LogConstants.CTX_TRANSPORT, "processing message:" +
packet); //$NON-NLS-1$
}
ServerWorkItem work = new ServerWorkItem(this, packet.getMessageKey(), packet,
this.csr);
work.process();
Modified: trunk/runtime/src/main/java/org/teiid/transport/SocketListener.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/SocketListener.java 2010-03-10
02:34:03 UTC (rev 1955)
+++ trunk/runtime/src/main/java/org/teiid/transport/SocketListener.java 2010-03-10
15:44:27 UTC (rev 1956)
@@ -67,8 +67,8 @@
}
this.nettyPool = Executors.newCachedThreadPool(new
NamedThreadFactory("NIO")); //$NON-NLS-1$
- if (LogManager.isMessageToBeRecorded(LogConstants.CTX_SERVER,
MessageLevel.DETAIL)) {
- LogManager.logDetail(LogConstants.CTX_SERVER, "server = " +
bindAddress + "binding to port:" + port); //$NON-NLS-1$ //$NON-NLS-2$
+ if (LogManager.isMessageToBeRecorded(LogConstants.CTX_TRANSPORT,
MessageLevel.DETAIL)) {
+ LogManager.logDetail(LogConstants.CTX_TRANSPORT, "server = " +
bindAddress + "binding to port:" + port); //$NON-NLS-1$ //$NON-NLS-2$
}
ChannelFactory factory = new NioServerSocketChannelFactory(this.nettyPool,
this.nettyPool, Math.min(Runtime.getRuntime().availableProcessors(), maxWorkers));
Modified: trunk/runtime/src/main/java/org/teiid/transport/SocketTransport.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/SocketTransport.java 2010-03-10
02:34:03 UTC (rev 1955)
+++ trunk/runtime/src/main/java/org/teiid/transport/SocketTransport.java 2010-03-10
15:44:27 UTC (rev 1956)
@@ -44,7 +44,7 @@
public void start() {
String bindAddress = this.config.getHostAddress().getHostAddress();
- LogManager.logDetail(LogConstants.CTX_SERVER,
RuntimePlugin.Util.getString("SocketTransport.1", new Object[] {bindAddress,
String.valueOf(this.config.getPortNumber())})); //$NON-NLS-1$
+ LogManager.logDetail(LogConstants.CTX_TRANSPORT,
RuntimePlugin.Util.getString("SocketTransport.1", new Object[] {bindAddress,
String.valueOf(this.config.getPortNumber())})); //$NON-NLS-1$
this.listener = new SocketListener(this.config.getPortNumber(), bindAddress,
this.config.getInputBufferSize(), this.config.getOutputBufferSize(),
this.config.getMaxSocketThreads(), this.config.getSSLConfiguration(), csr);
}