You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2009/04/07 14:36:09 UTC
svn commit: r762746 - in
/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime:
exception/ exception/UnsupportedOperatingSystemException.java io/
io/FileLockType.java io/FileType.java net/ net/TcpState.java
net/UdpState.java
Author: mturk
Date: Tue Apr 7 12:36:09 2009
New Revision: 762746
URL: http://svn.apache.org/viewvc?rev=762746&view=rev
Log:
Initial commit for making the svn directory layout
Added:
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/exception/
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/exception/UnsupportedOperatingSystemException.java (with props)
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/FileLockType.java (with props)
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/FileType.java (with props)
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/TcpState.java (with props)
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/UdpState.java (with props)
Added: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/exception/UnsupportedOperatingSystemException.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/exception/UnsupportedOperatingSystemException.java?rev=762746&view=auto
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/exception/UnsupportedOperatingSystemException.java (added)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/exception/UnsupportedOperatingSystemException.java Tue Apr 7 12:36:09 2009
@@ -0,0 +1,39 @@
+/* Apache Commons Runtime
+ * Copyright 2009 The Apache Software Foundation
+ *
+ *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 org.apache.commons.runtime.exception;
+
+/** UnsupportedOperatingSystemException
+ *
+ * @author Mladen Turk
+ *
+ */
+
+public class UnsupportedOperatingSystemException extends Exception {
+
+ public UnsupportedOperatingSystemException()
+ {
+ super();
+ }
+
+ public UnsupportedOperatingSystemException(String msg)
+ {
+ super(msg);
+ }
+}
Propchange: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/exception/UnsupportedOperatingSystemException.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/FileLockType.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/FileLockType.java?rev=762746&view=auto
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/FileLockType.java (added)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/FileLockType.java Tue Apr 7 12:36:09 2009
@@ -0,0 +1,73 @@
+/* Apache Commons Runtime
+ * Copyright 2009 The Apache Software Foundation
+ *
+ *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 org.apache.commons.runtime.io;
+
+import java.util.EnumSet;
+
+/**
+ * File lock types/flags.
+ */
+public enum FileLockType
+{
+ /** Shared lock. More than one process or thread can hold a shared lock
+ * at any given time. Essentially, this is a "read lock", preventing
+ * writers from establishing an exclusive lock.
+ */
+ SHARED( 1),
+
+ /** Exclusive lock. Only one process may hold an exclusive lock at any
+ * given time. This is analogous to a "write lock".
+ */
+ EXCLUSIVE(2),
+
+ /** Do not block while acquiring the file lock */
+ NONBLOCK( 0x0010);
+
+ private int value;
+ private FileLockType(int v)
+ {
+ value = v;
+ }
+
+ public int valueOf()
+ {
+ return value;
+ }
+
+ public static int bitmapOf(EnumSet<FileLockType> set)
+ {
+ int bitmap = 0;
+ if (set != null) {
+ for (FileLockType t : set)
+ bitmap += t.valueOf();
+ }
+ return bitmap;
+ }
+
+ public static EnumSet<FileLockType> valueOf(int value)
+ {
+ EnumSet<FileLockType> set = EnumSet.noneOf(FileLockType.class);
+ for (FileLockType e : values()) {
+ if ((e.value & value) == e.value)
+ set.add(e);
+ }
+ return set;
+ }
+}
Propchange: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/FileLockType.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/FileType.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/FileType.java?rev=762746&view=auto
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/FileType.java (added)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/FileType.java Tue Apr 7 12:36:09 2009
@@ -0,0 +1,74 @@
+/* Apache Commons Runtime
+ * Copyright 2009 The Apache Software Foundation
+ *
+ *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 org.apache.commons.runtime.io;
+
+/** FileType values for the filetype member of the
+ * FileInfo structure
+ * <br /><b>Warning :</b>: Not all of the filetypes below can be determined.
+ * For example, a given platform might not correctly report
+ * a socket descriptor as SOCK if that type isn't
+ * well-identified on that platform. In such cases where
+ * a filetype exists but cannot be described by the recognized
+ * flags below, the filetype will be UNKFILE. If the
+ * filetype member is not determined, the type will be NOFILE.
+ */
+public enum FileType
+{
+ /** No file type determined */
+ NOFILE( 0),
+ /** A regular file */
+ REG( 1),
+ /** A directory */
+ DIR( 2),
+ /** A character device */
+ CHR( 3),
+ /** A block device */
+ BLK( 4),
+ /** A FIFO / pipe */
+ PIPE( 5),
+ /** A symbolic link */
+ LNK( 6),
+ /** A [unix domain] socket */
+ SOCK( 7),
+ /** A file of some other unknown type */
+ UNKFILE( 127);
+
+
+ private int value;
+ private FileType(int v)
+ {
+ value = v;
+ }
+
+ public int valueOf()
+ {
+ return value;
+ }
+
+ public static FileType valueOf(int value)
+ {
+ for (FileType e : values()) {
+ if (e.value == value)
+ return e;
+ }
+ return UNKFILE;
+ }
+
+}
Propchange: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/FileType.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/TcpState.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/TcpState.java?rev=762746&view=auto
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/TcpState.java (added)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/TcpState.java Tue Apr 7 12:36:09 2009
@@ -0,0 +1,62 @@
+/* Apache Commons Runtime
+ * Copyright 2009 The Apache Software Foundation
+ *
+ *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 org.apache.commons.runtime.net;
+
+/**
+ * Determines the state of TCP connection
+ */
+public enum TcpState
+{
+
+ UNKNOWN( 0),
+ CLOSED( 1),
+ LISTENING( 2),
+ SYN_SENT( 3),
+ SYN_RCVD( 4),
+ ESTABLISHED( 5),
+ FIN_WAIT1( 6),
+ FIN_WAIT2( 7),
+ CLOSE_WAIT( 8),
+ CLOSING( 9),
+ LAST_ACK( 10),
+ TIME_WAIT( 11),
+ DELETE_TCB( 12);
+
+ private int value;
+ private TcpState(int v)
+ {
+ value = v;
+ }
+
+ public int valueOf()
+ {
+ return value;
+ }
+
+ public static TcpState valueOf(int value)
+ {
+ for (TcpState e : values()) {
+ if (e.value == value)
+ return e;
+ }
+ return UNKNOWN;
+ }
+
+}
Propchange: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/TcpState.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/UdpState.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/UdpState.java?rev=762746&view=auto
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/UdpState.java (added)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/UdpState.java Tue Apr 7 12:36:09 2009
@@ -0,0 +1,53 @@
+/* Apache Commons Runtime
+ * Copyright 2009 The Apache Software Foundation
+ *
+ *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 org.apache.commons.runtime.net;
+
+/**
+ * Determines the state of UDP connection
+ */
+public enum UdpState
+{
+
+ UNKNOWN( 0),
+ LISTENING( 1),
+ ESTABLISHED( 2),
+ CLOSED( 3);
+
+ private int value;
+ private UdpState(int v)
+ {
+ value = v;
+ }
+
+ public int valueOf()
+ {
+ return value;
+ }
+
+ public static UdpState valueOf(int value)
+ {
+ for (UdpState e : values()) {
+ if (e.value == value)
+ return e;
+ }
+ return UNKNOWN;
+ }
+
+}
Propchange: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/UdpState.java
------------------------------------------------------------------------------
svn:eol-style = native