Пример #1
0
 private JaxWsPoliciesSupport findPolicySupport(String serverInstanceId) {
   try {
     J2eePlatform j2eePlatform =
         Deployment.getDefault().getServerInstance(serverInstanceId).getJ2eePlatform();
     return JaxWsPoliciesSupport.getInstance(j2eePlatform);
   } catch (InstanceRemovedException e) {
     Logger.getLogger(PolicyManager.class.getName()).log(Level.INFO, null, e);
   }
   return null;
 }
Пример #2
0
 private void init() {
   J2eeModuleProvider moduleProvider = project.getLookup().lookup(J2eeModuleProvider.class);
   if (moduleProvider != null) {
     String id = moduleProvider.getServerInstanceID();
     support = findPolicySupport(id);
     if (support != null
         && !hasServicePolicies(wsdl, Collections.singletonList(support.getLookup(wsdl)))) {
       support = null;
     }
   } else {
     String[] serverInstanceIds = Deployment.getDefault().getServerInstanceIDs();
     Collection<JaxWsPoliciesSupport> supports =
         new ArrayList<JaxWsPoliciesSupport>(serverInstanceIds.length);
     List<Lookup> supportsLookup = new ArrayList<Lookup>(serverInstanceIds.length);
     for (String id : serverInstanceIds) {
       JaxWsPoliciesSupport foundSupport = findPolicySupport(id);
       if (foundSupport != null) {
         supports.add(foundSupport);
         supportsLookup.add(foundSupport.getLookup(wsdl));
       }
     }
     if (supports.isEmpty()) {
       return;
     }
     if (hasServicePolicies(wsdl, supportsLookup)) {
       int i = 0;
       for (JaxWsPoliciesSupport sup : supports) {
         if (sup.supports(wsdl, supportsLookup.get(i))) {
           support = sup;
           return;
         }
         i++;
       }
     }
   }
 }