001/* 002* Copyright (C) 2004 Thorsten Kamann 003* 004* File : UnixGroupProcessor.java 005* Description : Retrieves a list of the current groups 006* Author's email : thorsten.kamann@planetes.de 007* Author's Website : http://www.izforge.com 008* 009* Licensed under the Apache License, Version 2.0 (the "License"); 010* you may not use this file except in compliance with the License. 011* You may obtain a copy of the License at 012* 013* http://www.apache.org/licenses/LICENSE-2.0 014* 015* Unless required by applicable law or agreed to in writing, software 016* distributed under the License is distributed on an "AS IS" BASIS, 017* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 018* See the License for the specific language governing permissions and 019* limitations under the License. 020*/ 021 022package com.izforge.izpack.util; 023 024import java.io.BufferedReader; 025import java.io.FileReader; 026 027import com.izforge.izpack.panels.ProcessingClient; 028import com.izforge.izpack.panels.Processor; 029 030/** 031 * @author thorsten-kamann 032 */ 033public class UnixGroupProcessor implements Processor { 034 035 public String process (ProcessingClient client){ 036 String retValue = ""; 037 String filepath = "/etc/group"; 038 BufferedReader reader = null; 039 String line = ""; 040 041 try{ 042 reader = new BufferedReader(new FileReader(filepath)); 043 while ((line = reader.readLine()) != null){ 044 retValue += line.substring(0, line.indexOf(":"))+":"; 045 } 046 if (retValue.endsWith(":")){ 047 retValue = retValue.substring(0, retValue.length()-1); 048 } 049 }catch (Exception ex){ 050 retValue = ""; 051 } 052 053 return retValue; 054 } 055 056}