changeset 2626:9d83a097c50c

Fix COPR build This patch reworks some of the common-portability code to properly separate factories from what they create. Reviewed-by: sgehwolf, neugens Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2017-April/022786.html
author Simon Tooke <stooke@redhat.com>
date Fri, 14 Apr 2017 11:23:45 -0400
parents dbe52d6f8c7e
children 3b82970e37a4
files agent/core/src/main/java/com/redhat/thermostat/utils/management/internal/MXBeanConnectionPoolImpl.java agent/ipc/server/src/main/java/com/redhat/thermostat/agent/ipc/server/internal/IPCConfigurationWriter.java common/portability/src/main/java/com/redhat/thermostat/common/portability/PortableHostFactory.java common/portability/src/main/java/com/redhat/thermostat/common/portability/PortableHostImpl.java common/portability/src/main/java/com/redhat/thermostat/common/portability/PortableMemoryStat.java common/portability/src/main/java/com/redhat/thermostat/common/portability/PortableMemoryStatFactory.java common/portability/src/main/java/com/redhat/thermostat/common/portability/PortableProcessFactory.java common/portability/src/main/java/com/redhat/thermostat/common/portability/PortableProcessImpl.java common/portability/src/main/java/com/redhat/thermostat/common/portability/PortableProcessStat.java common/portability/src/main/java/com/redhat/thermostat/common/portability/PortableProcessStatFactory.java common/portability/src/main/java/com/redhat/thermostat/common/portability/PortableVmIoStat.java common/portability/src/main/java/com/redhat/thermostat/common/portability/PortableVmIoStatFactory.java common/portability/src/main/java/com/redhat/thermostat/common/portability/ProcessUserInfo.java common/portability/src/main/java/com/redhat/thermostat/common/portability/ProcessUserInfoBuilderFactory.java common/portability/src/main/java/com/redhat/thermostat/common/portability/SysConf.java common/portability/src/main/java/com/redhat/thermostat/common/portability/internal/macos/MacOSUserInfoBuilderImpl.java common/portability/src/main/java/com/redhat/thermostat/common/portability/internal/windows/WindowsUserInfoBuilderImpl.java host-cpu/agent/src/main/java/com/redhat/thermostat/host/cpu/agent/internal/WindowsCpuStatBuilder.java host-memory/agent/src/main/java/com/redhat/thermostat/host/memory/agent/internal/MemoryStatBuilder.java process-handler/src/main/java/com/redhat/thermostat/service/internal/windows/WindowsProcessUtilities.java system-backend/src/main/java/com/redhat/thermostat/backend/system/internal/HostInfoBuilderImpl.java system-backend/src/main/java/com/redhat/thermostat/backend/system/internal/InfoBuilderFactoryImpl.java system-backend/src/main/java/com/redhat/thermostat/backend/system/internal/ProcessEnvironmentBuilderImpl.java vm-byteman/agent/src/main/java/com/redhat/thermostat/vm/byteman/agent/internal/BytemanRequestReceiver.java vm-cpu/agent/src/main/java/com/redhat/thermostat/vm/cpu/agent/internal/ProcessStatusInfoBuilderImpl.java vm-cpu/agent/src/main/java/com/redhat/thermostat/vm/cpu/agent/internal/VmCpuBackend.java vm-io/agent/src/main/java/com/redhat/thermostat/vm/io/agent/internal/VmIoStatBuilderImpl.java
diffstat 27 files changed, 350 insertions(+), 177 deletions(-) [+]
line wrap: on
line diff
--- a/agent/core/src/main/java/com/redhat/thermostat/utils/management/internal/MXBeanConnectionPoolImpl.java	Fri Apr 14 06:44:29 2017 -0400
+++ b/agent/core/src/main/java/com/redhat/thermostat/utils/management/internal/MXBeanConnectionPoolImpl.java	Fri Apr 14 11:23:45 2017 -0400
@@ -61,6 +61,7 @@
 import com.redhat.thermostat.agent.ipc.server.ThermostatIPCCallbacks;
 import com.redhat.thermostat.common.portability.ProcessUserInfo;
 import com.redhat.thermostat.common.portability.ProcessUserInfoBuilder;
+import com.redhat.thermostat.common.portability.ProcessUserInfoBuilderFactory;
 import com.redhat.thermostat.common.portability.linux.ProcDataSource;
 import com.redhat.thermostat.agent.utils.management.MXBeanConnection;
 import com.redhat.thermostat.agent.utils.management.MXBeanConnectionException;
@@ -95,7 +96,7 @@
     private boolean started;
 
     public MXBeanConnectionPoolImpl(File binPath, UserNameUtil userNameUtil, AgentIPCService ipcService) {
-        this(new ConnectorCreator(), binPath, ProcessUserInfo.createBuilder(new ProcDataSource(), userNameUtil),
+        this(new ConnectorCreator(), binPath, ProcessUserInfoBuilderFactory.createBuilder(new ProcDataSource(), userNameUtil),
                 ipcService, new FileSystemUtils());
     }
 
--- a/agent/ipc/server/src/main/java/com/redhat/thermostat/agent/ipc/server/internal/IPCConfigurationWriter.java	Fri Apr 14 06:44:29 2017 -0400
+++ b/agent/ipc/server/src/main/java/com/redhat/thermostat/agent/ipc/server/internal/IPCConfigurationWriter.java	Fri Apr 14 11:23:45 2017 -0400
@@ -44,7 +44,7 @@
 import java.util.UUID;
 
 import com.redhat.thermostat.agent.ipc.common.internal.IPCType;
-import com.redhat.thermostat.common.portability.PortableProcessImpl;
+import com.redhat.thermostat.common.portability.PortableProcessFactory;
 import com.redhat.thermostat.shared.config.OS;
 
 class IPCConfigurationWriter {
@@ -167,7 +167,7 @@
             return new Properties();
         }
         int getCurrentUid() {
-            return PortableProcessImpl.getInstance().getUid(0); // if pid=0, gets uid of current process
+            return PortableProcessFactory.getInstance().getUid(0); // if pid=0, gets uid of current process
         }
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/portability/src/main/java/com/redhat/thermostat/common/portability/PortableHostFactory.java	Fri Apr 14 11:23:45 2017 -0400
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2012-2017 Red Hat, Inc.
+ *
+ * This file is part of Thermostat.
+ *
+ * Thermostat is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2, or (at your
+ * option) any later version.
+ *
+ * Thermostat 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
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Thermostat; see the file COPYING.  If not see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Linking this code with other modules is making a combined work
+ * based on this code.  Thus, the terms and conditions of the GNU
+ * General Public License cover the whole combination.
+ *
+ * As a special exception, the copyright holders of this code give
+ * you permission to link this code with independent modules to
+ * produce an executable, regardless of the license terms of these
+ * independent modules, and to copy and distribute the resulting
+ * executable under terms of your choice, provided that you also
+ * meet, for each linked independent module, the terms and conditions
+ * of the license of that module.  An independent module is a module
+ * which is not derived from or based on this code.  If you modify
+ * this code, you may extend this exception to your version of the
+ * library, but you are not obligated to do so.  If you do not wish
+ * to do so, delete this exception statement from your version.
+ */
+
+package com.redhat.thermostat.common.portability;
+
+import com.redhat.thermostat.common.portability.internal.linux.LinuxPortableHostImpl;
+import com.redhat.thermostat.common.portability.internal.macos.MacOSHostImpl;
+import com.redhat.thermostat.common.portability.internal.windows.WindowsPortableHostImpl;
+import com.redhat.thermostat.shared.config.OS;
+
+public class PortableHostFactory {
+
+    private static final PortableHost INSTANCE = createInstance();
+
+    private static PortableHost createInstance() {
+        return OS.IS_LINUX ? LinuxPortableHostImpl.createInstance()
+                : OS.IS_WINDOWS ? WindowsPortableHostImpl.createInstance() : MacOSHostImpl.createInstance();
+    }
+
+    public static PortableHost getInstance() {
+        return INSTANCE;
+    }
+}
+
--- a/common/portability/src/main/java/com/redhat/thermostat/common/portability/PortableHostImpl.java	Fri Apr 14 06:44:29 2017 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/*
- * Copyright 2012-2017 Red Hat, Inc.
- *
- * This file is part of Thermostat.
- *
- * Thermostat is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2, or (at your
- * option) any later version.
- *
- * Thermostat 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
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Thermostat; see the file COPYING.  If not see
- * <http://www.gnu.org/licenses/>.
- *
- * Linking this code with other modules is making a combined work
- * based on this code.  Thus, the terms and conditions of the GNU
- * General Public License cover the whole combination.
- *
- * As a special exception, the copyright holders of this code give
- * you permission to link this code with independent modules to
- * produce an executable, regardless of the license terms of these
- * independent modules, and to copy and distribute the resulting
- * executable under terms of your choice, provided that you also
- * meet, for each linked independent module, the terms and conditions
- * of the license of that module.  An independent module is a module
- * which is not derived from or based on this code.  If you modify
- * this code, you may extend this exception to your version of the
- * library, but you are not obligated to do so.  If you do not wish
- * to do so, delete this exception statement from your version.
- */
-
-package com.redhat.thermostat.common.portability;
-
-import com.redhat.thermostat.common.portability.internal.linux.LinuxPortableHostImpl;
-import com.redhat.thermostat.common.portability.internal.macos.MacOSHostImpl;
-import com.redhat.thermostat.common.portability.internal.windows.WindowsPortableHostImpl;
-import com.redhat.thermostat.shared.config.OS;
-
-public class PortableHostImpl {
-
-    private static final PortableHost INSTANCE = createInstance();
-
-    private static PortableHost createInstance() {
-        return OS.IS_LINUX ? LinuxPortableHostImpl.createInstance()
-                : OS.IS_WINDOWS ? WindowsPortableHostImpl.createInstance() : MacOSHostImpl.createInstance();
-    }
-
-    public static PortableHost getInstance() {
-        return INSTANCE;
-    }
-}
-
--- a/common/portability/src/main/java/com/redhat/thermostat/common/portability/PortableMemoryStat.java	Fri Apr 14 06:44:29 2017 -0400
+++ b/common/portability/src/main/java/com/redhat/thermostat/common/portability/PortableMemoryStat.java	Fri Apr 14 11:23:45 2017 -0400
@@ -82,8 +82,4 @@
     public long getCommitLimit() {
         return commitLimit;
     }
-
-    public static PortableMemoryStat build() {
-        return PortableHostImpl.getInstance().getMemoryStat();
-    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/portability/src/main/java/com/redhat/thermostat/common/portability/PortableMemoryStatFactory.java	Fri Apr 14 11:23:45 2017 -0400
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2012-2017 Red Hat, Inc.
+ *
+ * This file is part of Thermostat.
+ *
+ * Thermostat is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2, or (at your
+ * option) any later version.
+ *
+ * Thermostat 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
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Thermostat; see the file COPYING.  If not see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Linking this code with other modules is making a combined work
+ * based on this code.  Thus, the terms and conditions of the GNU
+ * General Public License cover the whole combination.
+ *
+ * As a special exception, the copyright holders of this code give
+ * you permission to link this code with independent modules to
+ * produce an executable, regardless of the license terms of these
+ * independent modules, and to copy and distribute the resulting
+ * executable under terms of your choice, provided that you also
+ * meet, for each linked independent module, the terms and conditions
+ * of the license of that module.  An independent module is a module
+ * which is not derived from or based on this code.  If you modify
+ * this code, you may extend this exception to your version of the
+ * library, but you are not obligated to do so.  If you do not wish
+ * to do so, delete this exception statement from your version.
+ */
+
+package com.redhat.thermostat.common.portability;
+
+public class PortableMemoryStatFactory {
+
+    public static PortableMemoryStat build() {
+        return PortableHostFactory.getInstance().getMemoryStat();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/portability/src/main/java/com/redhat/thermostat/common/portability/PortableProcessFactory.java	Fri Apr 14 11:23:45 2017 -0400
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2012-2017 Red Hat, Inc.
+ *
+ * This file is part of Thermostat.
+ *
+ * Thermostat is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2, or (at your
+ * option) any later version.
+ *
+ * Thermostat 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
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Thermostat; see the file COPYING.  If not see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Linking this code with other modules is making a combined work
+ * based on this code.  Thus, the terms and conditions of the GNU
+ * General Public License cover the whole combination.
+ *
+ * As a special exception, the copyright holders of this code give
+ * you permission to link this code with independent modules to
+ * produce an executable, regardless of the license terms of these
+ * independent modules, and to copy and distribute the resulting
+ * executable under terms of your choice, provided that you also
+ * meet, for each linked independent module, the terms and conditions
+ * of the license of that module.  An independent module is a module
+ * which is not derived from or based on this code.  If you modify
+ * this code, you may extend this exception to your version of the
+ * library, but you are not obligated to do so.  If you do not wish
+ * to do so, delete this exception statement from your version.
+ */
+
+package com.redhat.thermostat.common.portability;
+
+import com.redhat.thermostat.common.portability.internal.linux.LinuxPortableProcessImpl;
+import com.redhat.thermostat.common.portability.internal.macos.MacOSProcessImpl;
+import com.redhat.thermostat.common.portability.internal.windows.WindowsPortableProcessImpl;
+import com.redhat.thermostat.shared.config.OS;
+
+public final class PortableProcessFactory {
+
+    private static final PortableProcess INSTANCE = createInstance();
+
+    private static PortableProcess createInstance() {
+        return OS.IS_LINUX ? LinuxPortableProcessImpl.createInstance()
+            : OS.IS_WINDOWS ? WindowsPortableProcessImpl.createInstance() : MacOSProcessImpl.INSTANCE;
+    }
+
+    public static PortableProcess getInstance() {
+        return INSTANCE;
+    }
+}
--- a/common/portability/src/main/java/com/redhat/thermostat/common/portability/PortableProcessImpl.java	Fri Apr 14 06:44:29 2017 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
- * Copyright 2012-2017 Red Hat, Inc.
- *
- * This file is part of Thermostat.
- *
- * Thermostat is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2, or (at your
- * option) any later version.
- *
- * Thermostat 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
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Thermostat; see the file COPYING.  If not see
- * <http://www.gnu.org/licenses/>.
- *
- * Linking this code with other modules is making a combined work
- * based on this code.  Thus, the terms and conditions of the GNU
- * General Public License cover the whole combination.
- *
- * As a special exception, the copyright holders of this code give
- * you permission to link this code with independent modules to
- * produce an executable, regardless of the license terms of these
- * independent modules, and to copy and distribute the resulting
- * executable under terms of your choice, provided that you also
- * meet, for each linked independent module, the terms and conditions
- * of the license of that module.  An independent module is a module
- * which is not derived from or based on this code.  If you modify
- * this code, you may extend this exception to your version of the
- * library, but you are not obligated to do so.  If you do not wish
- * to do so, delete this exception statement from your version.
- */
-
-package com.redhat.thermostat.common.portability;
-
-import com.redhat.thermostat.common.portability.internal.linux.LinuxPortableProcessImpl;
-import com.redhat.thermostat.common.portability.internal.macos.MacOSProcessImpl;
-import com.redhat.thermostat.common.portability.internal.windows.WindowsPortableProcessImpl;
-import com.redhat.thermostat.shared.config.OS;
-
-public final class PortableProcessImpl {
-
-    private static final PortableProcess INSTANCE = createInstance();
-
-    private static PortableProcess createInstance() {
-        return OS.IS_LINUX ? LinuxPortableProcessImpl.createInstance()
-            : OS.IS_WINDOWS ? WindowsPortableProcessImpl.createInstance() : MacOSProcessImpl.INSTANCE;
-    }
-
-    public static PortableProcess getInstance() {
-        return INSTANCE;
-    }
-}
--- a/common/portability/src/main/java/com/redhat/thermostat/common/portability/PortableProcessStat.java	Fri Apr 14 06:44:29 2017 -0400
+++ b/common/portability/src/main/java/com/redhat/thermostat/common/portability/PortableProcessStat.java	Fri Apr 14 11:23:45 2017 -0400
@@ -69,9 +69,5 @@
     public long getKernelTime() {
         return kernelTime;
     }
-
-    public static PortableProcessStat build(int pid) {
-        return PortableProcessImpl.getInstance().getProcessStat(pid);
-    }
 }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/portability/src/main/java/com/redhat/thermostat/common/portability/PortableProcessStatFactory.java	Fri Apr 14 11:23:45 2017 -0400
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2012-2017 Red Hat, Inc.
+ *
+ * This file is part of Thermostat.
+ *
+ * Thermostat is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2, or (at your
+ * option) any later version.
+ *
+ * Thermostat 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
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Thermostat; see the file COPYING.  If not see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Linking this code with other modules is making a combined work
+ * based on this code.  Thus, the terms and conditions of the GNU
+ * General Public License cover the whole combination.
+ *
+ * As a special exception, the copyright holders of this code give
+ * you permission to link this code with independent modules to
+ * produce an executable, regardless of the license terms of these
+ * independent modules, and to copy and distribute the resulting
+ * executable under terms of your choice, provided that you also
+ * meet, for each linked independent module, the terms and conditions
+ * of the license of that module.  An independent module is a module
+ * which is not derived from or based on this code.  If you modify
+ * this code, you may extend this exception to your version of the
+ * library, but you are not obligated to do so.  If you do not wish
+ * to do so, delete this exception statement from your version.
+ */
+
+package com.redhat.thermostat.common.portability;
+
+public class PortableProcessStatFactory {
+
+    public static PortableProcessStat build(int pid) {
+        return PortableProcessFactory.getInstance().getProcessStat(pid);
+    }
+}
+
--- a/common/portability/src/main/java/com/redhat/thermostat/common/portability/PortableVmIoStat.java	Fri Apr 14 06:44:29 2017 -0400
+++ b/common/portability/src/main/java/com/redhat/thermostat/common/portability/PortableVmIoStat.java	Fri Apr 14 11:23:45 2017 -0400
@@ -55,10 +55,6 @@
         this.charactersWritten = charactersWritten;
     }
 
-    public static PortableVmIoStat build(Clock clock, int pid) {
-        return PortableProcessImpl.getInstance().getVmIoStat(clock, pid);
-    }
-
     public long getTimeStamp() {
         return timeStamp;
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/portability/src/main/java/com/redhat/thermostat/common/portability/PortableVmIoStatFactory.java	Fri Apr 14 11:23:45 2017 -0400
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2012-2017 Red Hat, Inc.
+ *
+ * This file is part of Thermostat.
+ *
+ * Thermostat is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2, or (at your
+ * option) any later version.
+ *
+ * Thermostat 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
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Thermostat; see the file COPYING.  If not see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Linking this code with other modules is making a combined work
+ * based on this code.  Thus, the terms and conditions of the GNU
+ * General Public License cover the whole combination.
+ *
+ * As a special exception, the copyright holders of this code give
+ * you permission to link this code with independent modules to
+ * produce an executable, regardless of the license terms of these
+ * independent modules, and to copy and distribute the resulting
+ * executable under terms of your choice, provided that you also
+ * meet, for each linked independent module, the terms and conditions
+ * of the license of that module.  An independent module is a module
+ * which is not derived from or based on this code.  If you modify
+ * this code, you may extend this exception to your version of the
+ * library, but you are not obligated to do so.  If you do not wish
+ * to do so, delete this exception statement from your version.
+ */
+
+package com.redhat.thermostat.common.portability;
+
+import com.redhat.thermostat.common.Clock;
+
+public class PortableVmIoStatFactory {
+
+    public static PortableVmIoStat build(Clock clock, int pid) {
+        return PortableProcessFactory.getInstance().getVmIoStat(clock, pid);
+    }
+}
--- a/common/portability/src/main/java/com/redhat/thermostat/common/portability/ProcessUserInfo.java	Fri Apr 14 06:44:29 2017 -0400
+++ b/common/portability/src/main/java/com/redhat/thermostat/common/portability/ProcessUserInfo.java	Fri Apr 14 11:23:45 2017 -0400
@@ -65,30 +65,4 @@
     public String getUsername() {
         return username;
     }
-
-    public static ProcessUserInfoBuilder createBuilder(ProcDataSource source, UserNameUtil userNameUtil) {
-        final ProcessUserInfoBuilder builder;
-        if (OS.IS_LINUX) {
-            builder = new LinuxProcessUserInfoBuilderImpl(source, userNameUtil);
-        } else if (OS.IS_WINDOWS) {
-            builder = new WindowsUserInfoBuilderImpl();
-        } else if (OS.IS_MACOS) {
-            builder = new MacOSUserInfoBuilderImpl();
-        } else {
-            throw new UnimplementedError("ProcessUserInfo");
-        }
-        return builder;
-    }
-
-    public static ProcessUserInfoBuilder createBuilder() {
-        final ProcessUserInfoBuilder builder;
-        if (OS.IS_LINUX) {
-            builder = new LinuxProcessUserInfoBuilderImpl();
-        } else if (OS.IS_WINDOWS) {
-            builder = new WindowsUserInfoBuilderImpl();
-        } else {
-            builder = new MacOSUserInfoBuilderImpl();
-        }
-        return builder;
-    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/portability/src/main/java/com/redhat/thermostat/common/portability/ProcessUserInfoBuilderFactory.java	Fri Apr 14 11:23:45 2017 -0400
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2012-2017 Red Hat, Inc.
+ *
+ * This file is part of Thermostat.
+ *
+ * Thermostat is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2, or (at your
+ * option) any later version.
+ *
+ * Thermostat 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
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Thermostat; see the file COPYING.  If not see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Linking this code with other modules is making a combined work
+ * based on this code.  Thus, the terms and conditions of the GNU
+ * General Public License cover the whole combination.
+ *
+ * As a special exception, the copyright holders of this code give
+ * you permission to link this code with independent modules to
+ * produce an executable, regardless of the license terms of these
+ * independent modules, and to copy and distribute the resulting
+ * executable under terms of your choice, provided that you also
+ * meet, for each linked independent module, the terms and conditions
+ * of the license of that module.  An independent module is a module
+ * which is not derived from or based on this code.  If you modify
+ * this code, you may extend this exception to your version of the
+ * library, but you are not obligated to do so.  If you do not wish
+ * to do so, delete this exception statement from your version.
+ */
+
+package com.redhat.thermostat.common.portability;
+
+import com.redhat.thermostat.common.portability.internal.UnimplementedError;
+import com.redhat.thermostat.common.portability.internal.linux.LinuxProcessUserInfoBuilderImpl;
+import com.redhat.thermostat.common.portability.internal.macos.MacOSUserInfoBuilderImpl;
+import com.redhat.thermostat.common.portability.internal.windows.WindowsUserInfoBuilderImpl;
+import com.redhat.thermostat.common.portability.linux.ProcDataSource;
+import com.redhat.thermostat.shared.config.OS;
+
+public class ProcessUserInfoBuilderFactory {
+
+    public static ProcessUserInfoBuilder createBuilder(ProcDataSource source, UserNameUtil userNameUtil) {
+        final ProcessUserInfoBuilder builder;
+        if (OS.IS_LINUX) {
+            builder = new LinuxProcessUserInfoBuilderImpl(source, userNameUtil);
+        } else if (OS.IS_WINDOWS) {
+            builder = new WindowsUserInfoBuilderImpl();
+        } else if (OS.IS_MACOS) {
+            builder = new MacOSUserInfoBuilderImpl();
+        } else {
+            throw new UnimplementedError("ProcessUserInfo");
+        }
+        return builder;
+    }
+
+    public static ProcessUserInfoBuilder createBuilder() {
+        final ProcessUserInfoBuilder builder;
+        if (OS.IS_LINUX) {
+            builder = new LinuxProcessUserInfoBuilderImpl();
+        } else if (OS.IS_WINDOWS) {
+            builder = new WindowsUserInfoBuilderImpl();
+        } else {
+            builder = new MacOSUserInfoBuilderImpl();
+        }
+        return builder;
+    }
+}
--- a/common/portability/src/main/java/com/redhat/thermostat/common/portability/SysConf.java	Fri Apr 14 06:44:29 2017 -0400
+++ b/common/portability/src/main/java/com/redhat/thermostat/common/portability/SysConf.java	Fri Apr 14 11:23:45 2017 -0400
@@ -58,7 +58,7 @@
     }
 
     private static long getWindowsClockTicksPerSecond() {
-        return PortableHostImpl.getInstance().getClockTicksPerSecond();
+        return PortableHostFactory.getInstance().getClockTicksPerSecond();
     }
 
     public static long getLinuxClockTicksPerSecond() {
--- a/common/portability/src/main/java/com/redhat/thermostat/common/portability/internal/macos/MacOSUserInfoBuilderImpl.java	Fri Apr 14 06:44:29 2017 -0400
+++ b/common/portability/src/main/java/com/redhat/thermostat/common/portability/internal/macos/MacOSUserInfoBuilderImpl.java	Fri Apr 14 11:23:45 2017 -0400
@@ -37,7 +37,7 @@
 package com.redhat.thermostat.common.portability.internal.macos;
 
 import com.redhat.thermostat.common.portability.PortableProcess;
-import com.redhat.thermostat.common.portability.PortableProcessImpl;
+import com.redhat.thermostat.common.portability.PortableProcessFactory;
 import com.redhat.thermostat.common.portability.ProcessUserInfo;
 import com.redhat.thermostat.common.portability.ProcessUserInfoBuilder;
 import com.redhat.thermostat.common.utils.LoggingUtils;
@@ -56,7 +56,7 @@
     private static final Logger logger = LoggingUtils.getLogger(MacOSUserInfoBuilderImpl.class);
 
     public MacOSUserInfoBuilderImpl() {
-        this(PortableProcessImpl.getInstance());
+        this(PortableProcessFactory.getInstance());
     }
 
     MacOSUserInfoBuilderImpl(PortableProcess helper) {
--- a/common/portability/src/main/java/com/redhat/thermostat/common/portability/internal/windows/WindowsUserInfoBuilderImpl.java	Fri Apr 14 06:44:29 2017 -0400
+++ b/common/portability/src/main/java/com/redhat/thermostat/common/portability/internal/windows/WindowsUserInfoBuilderImpl.java	Fri Apr 14 11:23:45 2017 -0400
@@ -36,7 +36,7 @@
 
 package com.redhat.thermostat.common.portability.internal.windows;
 
-import com.redhat.thermostat.common.portability.PortableProcessImpl;
+import com.redhat.thermostat.common.portability.PortableProcessFactory;
 import com.redhat.thermostat.common.portability.ProcessUserInfo;
 import com.redhat.thermostat.common.portability.ProcessUserInfoBuilder;
 import com.redhat.thermostat.common.portability.PortableProcess;
@@ -56,7 +56,7 @@
     private static final Logger logger = LoggingUtils.getLogger(WindowsUserInfoBuilderImpl.class);
 
     public WindowsUserInfoBuilderImpl() {
-        this(PortableProcessImpl.getInstance());
+        this(PortableProcessFactory.getInstance());
     }
 
     WindowsUserInfoBuilderImpl(PortableProcess helper) {
--- a/host-cpu/agent/src/main/java/com/redhat/thermostat/host/cpu/agent/internal/WindowsCpuStatBuilder.java	Fri Apr 14 06:44:29 2017 -0400
+++ b/host-cpu/agent/src/main/java/com/redhat/thermostat/host/cpu/agent/internal/WindowsCpuStatBuilder.java	Fri Apr 14 11:23:45 2017 -0400
@@ -38,7 +38,7 @@
 
 import com.redhat.thermostat.common.Clock;
 import com.redhat.thermostat.common.portability.PortableHost;
-import com.redhat.thermostat.common.portability.PortableHostImpl;
+import com.redhat.thermostat.common.portability.PortableHostFactory;
 import com.redhat.thermostat.host.cpu.common.model.CpuStat;
 import com.redhat.thermostat.storage.core.WriterID;
 
@@ -53,7 +53,7 @@
     WindowsCpuStatBuilder(Clock clock, WriterID writerId) {
         this.writerId = writerId;
         this.clock = clock;
-        this.portableHost = PortableHostImpl.getInstance();
+        this.portableHost = PortableHostFactory.getInstance();
     }
 
     @Override
--- a/host-memory/agent/src/main/java/com/redhat/thermostat/host/memory/agent/internal/MemoryStatBuilder.java	Fri Apr 14 06:44:29 2017 -0400
+++ b/host-memory/agent/src/main/java/com/redhat/thermostat/host/memory/agent/internal/MemoryStatBuilder.java	Fri Apr 14 11:23:45 2017 -0400
@@ -41,6 +41,7 @@
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
+import com.redhat.thermostat.common.portability.PortableMemoryStatFactory;
 import com.redhat.thermostat.common.portability.linux.ProcDataSource;
 import com.redhat.thermostat.common.NotImplementedException;
 import com.redhat.thermostat.common.Size;
@@ -127,7 +128,7 @@
     private MemoryStat buildPortably() {
         long timestamp = System.currentTimeMillis();
 
-        PortableMemoryStat memstat = PortableMemoryStat.build();
+        PortableMemoryStat memstat = PortableMemoryStatFactory.build();
 
         String wId = writerId.getWriterID();
         return new MemoryStat(wId, timestamp, memstat.getTotal(), memstat.getFree(), memstat.getBuffers(), memstat.getCached(), memstat.getSwapTotal(), memstat.getSwapFree(), memstat.getCommitLimit());
--- a/process-handler/src/main/java/com/redhat/thermostat/service/internal/windows/WindowsProcessUtilities.java	Fri Apr 14 06:44:29 2017 -0400
+++ b/process-handler/src/main/java/com/redhat/thermostat/service/internal/windows/WindowsProcessUtilities.java	Fri Apr 14 11:23:45 2017 -0400
@@ -36,7 +36,7 @@
 
 package com.redhat.thermostat.service.internal.windows;
 
-import com.redhat.thermostat.common.portability.PortableProcessImpl;
+import com.redhat.thermostat.common.portability.PortableProcessFactory;
 import com.redhat.thermostat.service.internal.ProcessUtilitiesBase;
 import com.redhat.thermostat.service.process.UNIXSignal;
 
@@ -74,7 +74,7 @@
 
     @Override
     public void sendSignal(Integer pid, UNIXSignal signal) {
-        PortableProcessImpl.getInstance().terminateProcess(pid);
+        PortableProcessFactory.getInstance().terminateProcess(pid);
     }
 
 }
--- a/system-backend/src/main/java/com/redhat/thermostat/backend/system/internal/HostInfoBuilderImpl.java	Fri Apr 14 06:44:29 2017 -0400
+++ b/system-backend/src/main/java/com/redhat/thermostat/backend/system/internal/HostInfoBuilderImpl.java	Fri Apr 14 11:23:45 2017 -0400
@@ -38,7 +38,7 @@
 
 import com.redhat.thermostat.common.portability.PortableHost;
 import com.redhat.thermostat.backend.system.internal.models.HostInfoBuilder;
-import com.redhat.thermostat.common.portability.PortableHostImpl;
+import com.redhat.thermostat.common.portability.PortableHostFactory;
 import com.redhat.thermostat.storage.core.WriterID;
 import com.redhat.thermostat.storage.model.HostInfo;
 
@@ -51,7 +51,7 @@
     private final PortableHost helper;
 
     HostInfoBuilderImpl(final WriterID writerID) {
-        this(writerID, PortableHostImpl.getInstance());
+        this(writerID, PortableHostFactory.getInstance());
     }
 
     HostInfoBuilderImpl(final WriterID writerID, PortableHost helper) {
--- a/system-backend/src/main/java/com/redhat/thermostat/backend/system/internal/InfoBuilderFactoryImpl.java	Fri Apr 14 06:44:29 2017 -0400
+++ b/system-backend/src/main/java/com/redhat/thermostat/backend/system/internal/InfoBuilderFactoryImpl.java	Fri Apr 14 11:23:45 2017 -0400
@@ -36,8 +36,8 @@
 
 package com.redhat.thermostat.backend.system.internal;
 
-import com.redhat.thermostat.common.portability.ProcessUserInfo;
 import com.redhat.thermostat.common.portability.ProcessUserInfoBuilder;
+import com.redhat.thermostat.common.portability.ProcessUserInfoBuilderFactory;
 import com.redhat.thermostat.common.portability.UserNameUtil;
 import com.redhat.thermostat.backend.system.internal.models.HostInfoBuilder;
 import com.redhat.thermostat.backend.system.internal.models.InfoBuilderFactory;
@@ -62,6 +62,6 @@
     }
 
     public ProcessUserInfoBuilder createProcessUserInfoBuilder(final UserNameUtil userNameUtil) {
-        return ProcessUserInfo.createBuilder(new ProcDataSource(), userNameUtil);
+        return ProcessUserInfoBuilderFactory.createBuilder(new ProcDataSource(), userNameUtil);
     }
 }
--- a/system-backend/src/main/java/com/redhat/thermostat/backend/system/internal/ProcessEnvironmentBuilderImpl.java	Fri Apr 14 06:44:29 2017 -0400
+++ b/system-backend/src/main/java/com/redhat/thermostat/backend/system/internal/ProcessEnvironmentBuilderImpl.java	Fri Apr 14 11:23:45 2017 -0400
@@ -38,7 +38,7 @@
 
 import com.redhat.thermostat.backend.system.internal.models.ProcessEnvironmentBuilder;
 import com.redhat.thermostat.common.portability.PortableProcess;
-import com.redhat.thermostat.common.portability.PortableProcessImpl;
+import com.redhat.thermostat.common.portability.PortableProcessFactory;
 
 import java.util.Map;
 
@@ -50,7 +50,7 @@
     private final PortableProcess helper;
 
     ProcessEnvironmentBuilderImpl() {
-        this(PortableProcessImpl.getInstance());
+        this(PortableProcessFactory.getInstance());
     }
 
     ProcessEnvironmentBuilderImpl(PortableProcess wh) {
--- a/vm-byteman/agent/src/main/java/com/redhat/thermostat/vm/byteman/agent/internal/BytemanRequestReceiver.java	Fri Apr 14 06:44:29 2017 -0400
+++ b/vm-byteman/agent/src/main/java/com/redhat/thermostat/vm/byteman/agent/internal/BytemanRequestReceiver.java	Fri Apr 14 11:23:45 2017 -0400
@@ -44,8 +44,8 @@
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
-import com.redhat.thermostat.common.portability.ProcessUserInfo;
 import com.redhat.thermostat.common.portability.ProcessUserInfoBuilder;
+import com.redhat.thermostat.common.portability.ProcessUserInfoBuilderFactory;
 import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.Property;
 import org.apache.felix.scr.annotations.Reference;
@@ -156,7 +156,7 @@
     }
     
     protected void bindUserNameUtil(UserNameUtil userNameUtil) {
-        ProcessUserInfoBuilder userInfoBuilder = ProcessUserInfo.createBuilder(new ProcDataSource(), userNameUtil);
+        ProcessUserInfoBuilder userInfoBuilder = ProcessUserInfoBuilderFactory.createBuilder(new ProcDataSource(), userNameUtil);
         attachManager.setUserInfoBuilder(userInfoBuilder);
     }
     
--- a/vm-cpu/agent/src/main/java/com/redhat/thermostat/vm/cpu/agent/internal/ProcessStatusInfoBuilderImpl.java	Fri Apr 14 06:44:29 2017 -0400
+++ b/vm-cpu/agent/src/main/java/com/redhat/thermostat/vm/cpu/agent/internal/ProcessStatusInfoBuilderImpl.java	Fri Apr 14 11:23:45 2017 -0400
@@ -36,7 +36,7 @@
 
 package com.redhat.thermostat.vm.cpu.agent.internal;
 
-import com.redhat.thermostat.common.portability.PortableProcessImpl;
+import com.redhat.thermostat.common.portability.PortableProcessFactory;
 import com.redhat.thermostat.common.portability.PortableProcessStat;
 
 /**
@@ -49,7 +49,7 @@
 
     public ProcessStatusInfo build(int pid) {
 
-        final PortableProcessStat info =  PortableProcessImpl.getInstance().getProcessStat(pid);
+        final PortableProcessStat info =  PortableProcessFactory.getInstance().getProcessStat(pid);
 
         return info != null ? new ProcessStatusInfo(pid, info.getUserTime(), info.getKernelTime()) : null;
     }
--- a/vm-cpu/agent/src/main/java/com/redhat/thermostat/vm/cpu/agent/internal/VmCpuBackend.java	Fri Apr 14 06:44:29 2017 -0400
+++ b/vm-cpu/agent/src/main/java/com/redhat/thermostat/vm/cpu/agent/internal/VmCpuBackend.java	Fri Apr 14 11:23:45 2017 -0400
@@ -50,7 +50,7 @@
 import com.redhat.thermostat.common.Clock;
 import com.redhat.thermostat.common.SystemClock;
 import com.redhat.thermostat.common.Version;
-import com.redhat.thermostat.common.portability.PortableHostImpl;
+import com.redhat.thermostat.common.portability.PortableHostFactory;
 import com.redhat.thermostat.common.utils.LoggingUtils;
 import com.redhat.thermostat.shared.config.OS;
 import com.redhat.thermostat.storage.core.WriterID;
@@ -112,7 +112,7 @@
         }
 
         private int getCpuCount() {
-            return PortableHostImpl.getInstance().getCPUCount();
+            return PortableHostFactory.getInstance().getCPUCount();
         }
 
         private int getLinuxCpuCount(ProcDataSource dataSource) {
--- a/vm-io/agent/src/main/java/com/redhat/thermostat/vm/io/agent/internal/VmIoStatBuilderImpl.java	Fri Apr 14 06:44:29 2017 -0400
+++ b/vm-io/agent/src/main/java/com/redhat/thermostat/vm/io/agent/internal/VmIoStatBuilderImpl.java	Fri Apr 14 11:23:45 2017 -0400
@@ -38,6 +38,7 @@
 
 import com.redhat.thermostat.common.Clock;
 import com.redhat.thermostat.common.portability.PortableVmIoStat;
+import com.redhat.thermostat.common.portability.PortableVmIoStatFactory;
 import com.redhat.thermostat.storage.core.WriterID;
 import com.redhat.thermostat.vm.io.common.VmIoStat;
 
@@ -53,7 +54,7 @@
 
     public synchronized VmIoStat build(String vmId, Integer pid) {
 
-        PortableVmIoStat data = PortableVmIoStat.build(clock, pid);
+        PortableVmIoStat data = PortableVmIoStatFactory.build(clock, pid);
         return (data != null) ? new VmIoStat(writerId, vmId, data.getTimeStamp(), data.getCharactersRead(), data.getCharactersWritten(), data.getReadSyscalls(), data.getWriteSyscalls()) : null;
     }