2010-05-14 3 views
0

JMX를 사용하는 websphere J2C 데이터 소스 커넥터에서 비밀번호를 업데이트하려고합니다. 누구든지 소스 나 팁을 가지고 있습니까?새로운 websphere 데이터 소스를 생성하기위한 JMX 코드가있는 사람이 있습니까?

public synchronized List<String> getDBPools() { 

    return (List) WSSubject.doAs(this.adminSubject, 
      new java.security.PrivilegedAction() { 
       public Object run() { 
        // Subject is associated with the current thread context 
        return java.security.AccessController 
          .doPrivileged(new java.security.PrivilegedAction() { 
           public Object run() { 
            List<String> result = new ArrayList<String>(); 

            try { 
             Session session = new Session(); 

             // Get the ConfigService 
             // implementation. 
             ConfigService configService = ConfigServiceFactory 
               .getConfigService(); 
             ObjectName dsType = ConfigServiceHelper 
               .createObjectName(null, 
                 "DataSource", null); 
             ObjectName[] datasources = configService 
               .queryConfigObjects(
                 session, null, 
                 dsType, null); 

             for (int i = 0; i < datasources.length; i++) { 
              ObjectName dsObject = datasources[i]; 
              log 
                .debug("OBJ NAME = " 
                  + dsObject 
                    .getKeyProperty(SystemAttributes._WEBSPHERE_CONFIG_DATA_DISPLAY_NAME)); 
              log 
                .debug("OBJ ID = " 
                  + dsObject 
                    .getKeyProperty(SystemAttributes._WEBSPHERE_CONFIG_DATA_ID)); 
              log 
                .debug("OBJ TYPE = " 
                  + dsObject 
                    .getKeyProperty(SystemAttributes._WEBSPHERE_CONFIG_DATA_TYPE)); 

              String dsName = dsObject 
                .getKeyProperty(SystemAttributes._WEBSPHERE_CONFIG_DATA_DISPLAY_NAME); 

              if (!dsName 
                .equals("DefaultEJBTimerDataSource")) { 
               result.add(dsName); 
              } 
             } 
            } catch (ConfigServiceException ex) { 
             log 
               .error(
                 "Error in JMX Query string", 
                 ex); 
            } catch (ConnectorException ex) { 
             log 
               .error(
                 "Error connecting to the admin service", 
                 ex); 
            } 
            return result; 
           } 

          }); 
       } 
      }); 
} 
:

환호,

트레버 여기

답변

0

는 데이터 소스의 목록을 얻을 수있는 코드입니다 JMX를 사용하여 구성한다
관련 문제