亲棋牌手机版

Home » apache-ivyde-sources-2.0.0.final-200907011148-RELEASE » org.apache.ivyde.common.ivyfile » [javadoc | source]
    1   /*
    2    *  Licensed to the Apache Software Foundation (ASF) under one or more
    3    *  contributor license agreements.  See the NOTICE file distributed with
    4    *  this work for additional information regarding copyright ownership.
    5    *  The ASF licenses this file to You under the Apache License, Version 2.0
    6    *  (the "License"); you may not use this file except in compliance with
    7    *  the License.  You may obtain a copy of the License at
    8    *
    9    *      http://www.apache.org/licenses/LICENSE-2.0
   10    *
   11    *  Unless required by applicable law or agreed to in writing, software
   12    *  distributed under the License is distributed on an "AS IS" BASIS,
   13    *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   14    *  See the License for the specific language governing permissions and
   15    *  limitations under the License.
   16    *
   17    */
   18   package org.apache.ivyde.common.ivyfile;
   19   
   20   import java.util.ArrayList;
   21   import java.util.List;
   22   import java.util.Map;
   23   import java.util.regex.Matcher;
   24   import java.util.regex.Pattern;
   25   
   26   import org.apache.ivyde.common.model.IvyFile;
   27   import org.apache.ivyde.common.model.IvyModelSettings;
   28   
   29   public class IvyModuleDescriptorFile extends IvyFile {
   30       private static final Pattern CONF_PATTERN = Pattern.compile("<[\\s]*conf[^>]+name=\"([^\"]+)");
   31   
   32       private static final Pattern CONFIGURATIONS_END_PATTERN = Pattern
   33               .compile("</[\\s]*configurations[\\s]*>");
   34   
   35       private static final Pattern CONFIGURATIONS_START_PATTERN = Pattern
   36               .compile("<[\\s]*configurations[\\s]*>");
   37   
   38       public IvyModuleDescriptorFile(IvyModelSettings settings, String projectName, String doc) {
   39           this(settings, projectName, doc, 0);
   40       }
   41   
   42       public IvyModuleDescriptorFile(IvyModelSettings settings, String projectName, String doc, int currentOffset) {
   43           super(settings, projectName, doc, currentOffset);
   44       }
   45   
   46       public String[] getConfigurationNames() {
   47           Pattern p = CONFIGURATIONS_START_PATTERN;
   48           Matcher m = p.matcher(getDoc());
   49           if (m.find()) {
   50               int start = m.end();
   51               p = CONFIGURATIONS_END_PATTERN;
   52               m = p.matcher(getDoc());
   53               int end = getDoc().length();
   54               if (m.find(start)) {
   55                   end = m.start();
   56               }
   57               p = CONF_PATTERN;
   58               m = p.matcher(getDoc());
   59               List ret = new ArrayList();
   60               for (boolean found = m.find(start); found && m.end() < end; found = m.find()) {
   61                   ret.add(m.group(1));
   62               }
   63               return (String[]) ret.toArray(new String[ret.size()]);
   64           } else {
   65               return new String[] {"default"};
   66           }
   67       }
   68   
   69       public String getOrganisation() {
   70           Pattern p = Pattern.compile("<[\\s]*info[^>]*organisation[\\s]*=[\\s]*\"([^\"]+)");
   71           Matcher m = p.matcher(getDoc());
   72           if (m.find()) {
   73               return m.group(1);
   74           }
   75           return null;
   76       }
   77   
   78       public String getDependencyOrganisation() {
   79           Map otherAttValues = getAllAttsValues();
   80           return getDependencyOrganisation(otherAttValues);
   81       }
   82   
   83       public String getDependencyOrganisation(Map otherAttValues) {
   84           return otherAttValues != null && otherAttValues.get("org") != null ? (String) otherAttValues
   85                   .get("org")
   86                   : getOrganisation();
   87       }
   88   }

Home » apache-ivyde-sources-2.0.0.final-200907011148-RELEASE » org.apache.ivyde.common.ivyfile » [javadoc | source]
乐优彩票天天红单下载 乐博现金lb377775 乐优彩票登入,备用,官方网址 乐优彩票网址是多少 乐优炫彩app 乐博28app下载 乐优炫彩app下载 乐优炫彩app天天红单 乐优炫彩天天红单 乐优炫彩官网