Package xregistry

Examples of xregistry.XregistryException


                wsdlStr.append(new String(buf, 0, read));
            }
            in.close();
            return wsdlStr.toString();
        } catch (IOException e) {
            throw new XregistryException(e);
        }
    }
View Full Code Here


            byte[] content = new byte[in.available()];
            in.read(content);
            in.close();
            return new String(content);
        } catch (FileNotFoundException e) {
            throw new XregistryException(e);
        } catch (IOException e) {
            throw new XregistryException(e);
        }
    }
View Full Code Here

        try {

            System.out.println(prettyPrint2String(ele));

        } catch (IllegalArgumentException e) {
            throw new XregistryException(e);
        } catch (IllegalStateException e) {
            throw new XregistryException(e);
        } catch (XmlBuilderException e) {
            throw new XregistryException(e);
        }
    }
View Full Code Here

        try {
            if (serviceURL.startsWith("https")) {
                boolean useHostKey = true;

                if (globalConfiguration == null) {
                    throw new XregistryException(
                            "To make Secure WSIF client Global configuration must nor be Null");
                }
                SoapHttpDynamicInfosetInvoker invoker = createSecureInvoker(globalConfiguration,
                        useHostKey);
                String wsdlAsStr = invoker.invokeHttpGet(serviceURL);
                // System.out.println(wsdlAsStr);
                XmlElement el = XmlConstants.BUILDER
                        .parseFragmentFromReader(new StringReader(wsdlAsStr));
                WsdlDefinitions def = new WsdlDefinitions(el);
               
               
                WSIFServiceFactory wsf = WSIFServiceFactory.newInstance();
                WSIFService serv = wsf.getService(def);
                serv.addLocalProvider(new Provider(invoker));
                client = XmlBeansWSIFRuntime.getDefault().newClientFor(serv.getPort());
                ((XsulSoapPort) client.getPort()).setInvoker(invoker);
               
               
               
//                WsdlResolver wsdlResolver = WsdlResolver.getInstance();
//                wsdlResolver.setSecureInvoker(invoker);
//               
////                String wsdlAsStr = invoker.invokeHttpGet(serviceURL);
////                // System.out.println(wsdlAsStr);
////                XmlElement el = XmlConstants.BUILDER
////                        .parseFragmentFromReader(new StringReader(wsdlAsStr));
////                WsdlDefinitions def = new WsdlDefinitions(el);
//                WsdlDefinitions def = wsdlResolver.loadWsdl(new URI(serviceURL));
//               
//                WSIFServiceFactory wsf = WSIFServiceFactory.newInstance();
//                WSIFService serv = wsf.getService(def);
//                serv.addLocalProvider(new Provider(invoker));
//                client = XmlBeansWSIFRuntime.getDefault().newClientFor(serv.getPort());
//                ((XsulSoapPort) client.getPort()).setInvoker(invoker);
            } else {
                client = XmlBeansWSIFRuntime.newClient(serviceURL);
            }
        } catch (WSIFException e) {
            throw new XregistryException(e);
        } catch (XsulException e) {
            throw new XregistryException(e);
        } catch (XmlBuilderException e) {
            throw new XregistryException(e);
        } catch (IOException e) {
            throw new XregistryException(e);
        } catch (GeneralSecurityException e) {
            throw new XregistryException(e);
        } catch (GSSException e) {
            throw new XregistryException(e);
        }
        return client;
    }
View Full Code Here

                    tempTrustedCasOut.write(Utils.readFromStream(trustedCasInStream).getBytes());
                    tempTrustedCasOut.close();
                    certs = CertUtil.loadCertificates(tempTrustedCas.getAbsolutePath());
                    tempTrustedCas.deleteOnExit();
                }else{
                    throw new XregistryException("Server is secured, but can not find trusted certificates file");       
                }
            }
            GSSCredential credential = globalConfiguration.getCredential();
            invoker = new GsiInvoker(credential,certs);
            globalConfiguration.setUserDN(credential.getName().toString());
View Full Code Here

            globusCred.verify();
            gssCred = getGSSCredential(globusCred);

            return gssCred;
        } catch (GlobusCredentialException e) {
            throw new XregistryException(e);
        } catch (Exception e) {
            throw new XregistryException(e);
        }
    }
View Full Code Here

                }else{
                    log.info("Group "+ action + " realted to capability is not found");
                }
            }
        } catch (SQLException e) {
            throw new XregistryException(e);
        }finally{
            globalContext.closeConnection(connection);
        }
       
    }
View Full Code Here

            if(matcher.matches()){
                return new String[]{matcher.group(1),URLDecoder.decode(matcher.group(2),"UTF-8")};
            }
            return null;
        } catch (UnsupportedEncodingException e) {
            throw new XregistryException(e);
        }
    }
View Full Code Here

                }else{
                    log.info("Group "+ action + " realted to capability is not found");
                }
            }
        } catch (SQLException e) {
            throw new XregistryException(e);
        }finally{
            globalContext.closeConnection(connection);
        }
       
    }
View Full Code Here

            }else if(actor != null){
                sql = GET_CAPABILITIES_BY_ACTOR;
                statement = connection.prepareStatement(sql);
                statement.setString(1, actor);
            }else{
                throw new XregistryException("At least one of the Actor or resource ID must not be null");
            }
            log.info("Execuate SQL "+ statement);
            ResultSet results = statement.executeQuery();
           
            ArrayList<CapabilityToken> tokenList = new ArrayList<CapabilityToken>();
            while(results.next()){
                CapabilityToken captoken = CapabilityToken.Factory.newInstance();
                captoken.setActor(results.getString(ALLOWED_ACTOR));
                captoken.setResourceID(results.getString(RESOURCE_ID));
                captoken.setActorType(results.getBoolean(IS_USER));
               
                String capActionStr = results.getString(ACTION_TYPE);
                Action capAction = Action.All;
                if(capActionStr != null){
                    capAction = Action.valueOf(capActionStr);
                }
               
                //If use has give a search action, skip everything does not match
                if(searchAction != null){
                    if(!capAction.equals(Action.All) && !capAction.equals(searchAction)){
                        break;
                    }
                }
                captoken.setAction(capAction.toString());
                String assertion = results.getString(ASSERTION);
                if(assertion != null){
                    captoken.setAssertions(assertion);
                }
               
               
                //TODO it throws a exception when I try to get null time stamp
//                Timestamp notbefore = results.getTimestamp(NOT_BEFORE);
//                if(notbefore != null){
//                    XmlDateTime notbeforeXmlbeansVal = XmlDateTime.Factory.newInstance();
//                    notbeforeXmlbeansVal.setDateValue(notbefore);
//                    captoken.xsetNotbefore(notbeforeXmlbeansVal);
//                }
//               
//                Timestamp notAfter = results.getTimestamp(NOT_AFTER);
//                if(notAfter != null){
//                    XmlDateTime notAfterXmlbeansVal = XmlDateTime.Factory.newInstance();
//                    notAfterXmlbeansVal.setDateValue(notAfter);
//                    captoken.xsetNotbefore(notAfterXmlbeansVal);
//                }
               
                tokenList.add(captoken);
            }
           
            return tokenList.toArray(new CapabilityToken[0]);
        } catch (SQLException e) {
            throw new XregistryException(e);
        }finally{
            globalContext.closeConnection(connection);
        }
    }
View Full Code Here

TOP

Related Classes of xregistry.XregistryException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.