Coverage Report - org.seasar.uruma.container.cooldeploy.UrumaCoolComponentAutoRegister
 
Classes in this File Line Coverage Branch Coverage Complexity
UrumaCoolComponentAutoRegister
0%
0/17
0%
0/6
0
 
 1  
 /*
 2  
  * Copyright 2004-2008 the Seasar Foundation and the Others.
 3  
  *
 4  
  * Licensed under the Apache License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  *     http://www.apache.org/licenses/LICENSE-2.0
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 13  
  * either express or implied. See the License for the specific language
 14  
  * governing permissions and limitations under the License.
 15  
  */
 16  
 package org.seasar.uruma.container.cooldeploy;
 17  
 
 18  
 import java.io.IOException;
 19  
 import java.net.URL;
 20  
 
 21  
 import org.seasar.framework.container.cooldeploy.CoolComponentAutoRegister;
 22  
 import org.seasar.framework.convention.NamingConvention;
 23  
 import org.seasar.framework.util.URLUtil;
 24  
 import org.seasar.framework.util.ClassTraversal.ClassHandler;
 25  
 import org.seasar.uruma.core.UrumaMessageCodes;
 26  
 import org.seasar.uruma.log.UrumaLogger;
 27  
 import org.seasar.uruma.rcp.util.RcpResourceUtil;
 28  
 
 29  
 /**
 30  
  * Uruma COOL deploy用の {@link NamingConvention}に一致するコンポーネントを自動登録するクラスです。
 31  
  * 
 32  
  * @author y.sugigami
 33  
  * 
 34  
  */
 35  0
 public class UrumaCoolComponentAutoRegister extends CoolComponentAutoRegister
 36  
         implements ClassHandler, UrumaMessageCodes {
 37  0
     private static final UrumaLogger logger = UrumaLogger
 38  
             .getLogger(UrumaCoolComponentAutoRegister.class);
 39  
 
 40  
     /**
 41  
      * 自動登録を行います。
 42  
      */
 43  
     @Override
 44  
     public void registerAll() {
 45  0
         final String[] rootPackageNames = getNamingConvention()
 46  
                 .getRootPackageNames();
 47  0
         if (rootPackageNames != null) {
 48  0
             for (int i = 0; i < rootPackageNames.length; ++i) {
 49  0
                 final String rootDir = rootPackageNames[i].replace('.', '/');
 50  
                 try {
 51  0
                     URL localUrl = RcpResourceUtil.getLocalResourceUrl(rootDir);
 52  0
                     if (localUrl != null) {
 53  0
                         final Strategy strategy = getStrategy(URLUtil
 54  
                                 .toCanonicalProtocol(localUrl.getProtocol()));
 55  0
                         strategy.registerAll(rootDir, localUrl);
 56  0
                     } else {
 57  0
                         logger.log(COOLDEPLOY_PACKAGE_NOT_FOUND, rootDir);
 58  
                     }
 59  0
                 } catch (IOException ex) {
 60  0
                     logger.log(COOLDEPLOY_PACKAGE_NOT_FOUND, rootDir);
 61  0
                 }
 62  
             }
 63  
         }
 64  0
         registerdClasses.clear();
 65  0
     }
 66  
 }