Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Licensed to the Apache Software Foundation (ASF) under one
   * or more contributor license agreements.  See the NOTICE file
   * distributed with this work for additional information
   * regarding copyright ownership.  The ASF licenses this file
   * to you under the Apache License, Version 2.0 (the
   * "License"); you may not use this file except in compliance
   * with the License.  You may obtain a copy of the License at
   * 
  *   http://www.apache.org/licenses/LICENSE-2.0
  * 
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  * KIND, either express or implied.  See the License for the
  * specific language governing permissions and limitations
  * under the License.    
  */
 package org.apache.tuscany.sca.policy.security.jaas;
 
 import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
 import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
 
 

Version:
$Rev: 825773 $ $Date: 2009-10-16 08:42:26 +0300 (Fri, 16 Oct 2009) $
 
     private static final String callbackHandler = "callbackHandler";
     private static final String SCA10_TUSCANY_NS = "http://tuscany.apache.org/xmlns/sca/1.1";
     public static final QName CALLBACK_HANDLER_QNAME = new QName();
     public static final QName CONFIGURATION_QNAME = new QName("configurationName");
     
     
     public QName getArtifactType() {
         return ;
     }
     
     public JaasAuthenticationPolicyProcessor(FactoryExtensionPoint modelFactories) {
     }
    
    
Report a error.

Parameters:
problems
message
model
 
     private void error(Monitor monitorString messageObject modelObject... messageParameters) {
     	 if (monitor != null) {
     		 Problem problem = monitor.createProblem(this.getClass().getName(), "policy-security-validation-messages".modelmessage, (Object[])messageParameters);
     	     monitor.problem(problem);
     	 }        
     }
     
         JaasAuthenticationPolicy policy = new JaasAuthenticationPolicy();
         int event = reader.getEventType();
         QName name = null;
         
         while (reader.hasNext()) {
             event = reader.getEventType();
             switch (event) {
                 case  : {
                     name = reader.getName();
                     if (name.equals()) {
                         String callbackHandlerClassName = reader.getElementText();
                         if (callbackHandlerClassName != null) {
                             policy.setCallbackHandlerClassName(callbackHandlerClassName.trim());
                         }
                     }
                     if (name.equals()) {
                         String configurationName = reader.getElementText();
                         if (configurationName != null) {
                             policy.setConfigurationName(configurationName.trim());
                         }
                     } 
 
                     break;
                 }
             }
            
            if ( event ==  ) {
                if ( .equals(reader.getName()) ) {
                    break;
                } 
            }
            
            //Read the next element
            if (reader.hasNext()) {
                reader.next();
            }
        }
         
        return policy;
    }
    public void write(JaasAuthenticationPolicy policyXMLStreamWriter writerProcessorContext contextthrows ContributionWriteException,
                                                        XMLStreamException {
        String prefix = "tuscany";
        writer.writeStartElement(prefix
                                 .getLocalPart(),
                                 .getNamespaceURI());
        writer.writeNamespace("tuscany");
        
       
        writer.writeEndElement();
    }
        return JaasAuthenticationPolicy.class;
    }
    public void resolve(JaasAuthenticationPolicy policyModelResolver resolverProcessorContext contextthrows ContributionResolveException {
         if (policy.getCallbackHandlerClassName() != null) {
             ClassReference classReference = new ClassReference(policy.getCallbackHandlerClassName());
             classReference = resolver.resolveModel(ClassReference.classclassReferencecontext);
             Class<?> callbackClass = classReference.getJavaClass();
             if (callbackClass == null) {
            	 error(context.getMonitor(), "ClassNotFoundException"resolverpolicy.getCallbackHandlerClassName());
                 //throw new ContributionResolveException(new ClassNotFoundException(policy.getCallbackHandlerClassName()));
             } else {
                 policy.setCallbackHandlerClass(callbackClass);
                 policy.setUnresolved(false);
             }             
         }
    }
    
New to GrepCode? Check out our FAQ X