com.sun.istack.internal.Nullable Java Examples

The following examples show how to use com.sun.istack.internal.Nullable. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractSchemaValidationTube.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Adds inscope namespaces as attributes to  <xsd:schema> fragment nodes.
 *
 * @param nss namespace context info
 * @param elem that is patched with inscope namespaces
 */
private @Nullable void patchDOMFragment(NamespaceSupport nss, Element elem) {
    NamedNodeMap atts = elem.getAttributes();
    for( Enumeration en = nss.getPrefixes(); en.hasMoreElements(); ) {
        String prefix = (String)en.nextElement();

        for( int i=0; i<atts.getLength(); i++ ) {
            Attr a = (Attr)atts.item(i);
            if (!"xmlns".equals(a.getPrefix()) || !a.getLocalName().equals(prefix)) {
                if (LOGGER.isLoggable(Level.FINE)) {
                    LOGGER.log(Level.FINE, "Patching with xmlns:{0}={1}", new Object[]{prefix, nss.getURI(prefix)});
                }
                elem.setAttributeNS(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, "xmlns:"+prefix, nss.getURI(prefix));
            }
        }
    }
}
 
Example #2
Source File: MetadataFinder.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private @Nullable Element getFromMetadataResolver(String systemId, Exception ex) {
    //try MEX
    MetaDataResolver resolver;
    ServiceDescriptor serviceDescriptor = null;
    for (MetadataResolverFactory resolverFactory : ServiceFinder.find(MetadataResolverFactory.class)) {
        resolver = resolverFactory.metadataResolver(options.entityResolver);
        try {
            serviceDescriptor = resolver.resolve(new URI(systemId));
            //we got the ServiceDescriptor, now break
            if (serviceDescriptor != null)
                break;
        } catch (URISyntaxException e) {
            throw new ParseException(e);
        }
    }

    if (serviceDescriptor != null) {
        errorReceiver.warning(new SAXParseException(WsdlMessages.TRY_WITH_MEX(ex.getMessage()), null, ex));
        return parseMetadata(systemId, serviceDescriptor);
    } else {
        errorReceiver.error(null, WsdlMessages.PARSING_UNABLE_TO_GET_METADATA(ex.getMessage(), WscompileMessages.WSIMPORT_NO_WSDL(systemId)), ex);
    }
    return null;
}
 
Example #3
Source File: BaseDistributedPropertySet.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public @Nullable <T extends com.oracle.webservices.internal.api.message.PropertySet> T getSatellite(Class<T> satelliteClass) {
    T satellite = (T) satellites.get(satelliteClass);
    if (satellite != null) {
        return satellite;
    }

    for (PropertySet child : satellites.values()) {
        if (satelliteClass.isInstance(child)) {
            return satelliteClass.cast(child);
        }

        if (DistributedPropertySet.class.isInstance(child)) {
            satellite = DistributedPropertySet.class.cast(child).getSatellite(satelliteClass);
            if (satellite != null) {
                return satellite;
            }
        }
    }
    return null;
}
 
Example #4
Source File: Stubs.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Creates a new {@link Dispatch} stub that connects to the given pipe.
 *
 * @param portInfo
 *      see <a href="#param">common parameters</a>
 * @param owner
 *      see <a href="#param">common parameters</a>
 * @param binding
 *      see <a href="#param">common parameters</a>
 * @param clazz
 *      Type of the {@link Dispatch} to be created.
 *      See {@link Service#createDispatch(QName, Class, Service.Mode)}.
 * @param mode
 *      The mode of the dispatch.
 *      See {@link Service#createDispatch(QName, Class, Service.Mode)}.
 * @param epr
 *      see <a href="#param">common parameters</a>
 * TODO: are these parameters making sense?
 */
public static <T> Dispatch<T> createDispatch(WSPortInfo portInfo,
                                             WSService owner,
                                             WSBinding binding,
                                             Class<T> clazz, Service.Mode mode,
                                             @Nullable WSEndpointReference epr) {
    if (clazz == SOAPMessage.class) {
        return (Dispatch<T>) createSAAJDispatch(portInfo, binding, mode, epr);
    } else if (clazz == Source.class) {
        return (Dispatch<T>) createSourceDispatch(portInfo, binding, mode, epr);
    } else if (clazz == DataSource.class) {
        return (Dispatch<T>) createDataSourceDispatch(portInfo, binding, mode, epr);
    } else if (clazz == Message.class) {
        if(mode==Mode.MESSAGE)
            return (Dispatch<T>) createMessageDispatch(portInfo, binding, epr);
        else
            throw new WebServiceException(mode+" not supported with Dispatch<Message>");
    } else if (clazz == Packet.class) {
        if(mode==Mode.MESSAGE)
            return (Dispatch<T>) createPacketDispatch(portInfo, binding, epr);
        else
            throw new WebServiceException(mode+" not supported with Dispatch<Packet>");
    } else
        throw new WebServiceException("Unknown class type " + clazz.getName());
}
 
Example #5
Source File: CElementInfo.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public void initContentType(TypeUse contentType, @Nullable XSElementDecl source, XmlString defaultValue) {
    assert this.property==null; // must not be called twice

    this.property = new CElementPropertyInfo("Value",
            contentType.isCollection()?REPEATED_VALUE:NOT_REPEATED,
            contentType.idUse(),
            contentType.getExpectedMimeType(),
            source,null,getLocator(),true);
    this.property.setAdapter(contentType.getAdapterUse());
    BIInlineBinaryData.handle(source,property);
    property.getTypes().add(new CTypeRef(contentType.getInfo(),tagName,CTypeRef.getSimpleTypeName(source), true,defaultValue));
    this.type = NavigatorImpl.createParameterizedType(
        NavigatorImpl.theInstance.ref(JAXBElement.class),
        getContentInMemoryType() );

    BIFactoryMethod factoryMethod = Ring.get(BGMBuilder.class).getBindInfo(source).get(BIFactoryMethod.class);
    if(factoryMethod!=null) {
        factoryMethod.markAsAcknowledged();
        this.squeezedName = factoryMethod.name;
    }

}
 
Example #6
Source File: CustomizableThreadPoolExecutor.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
/**
 * 提供一个初始化线程池的方法。
 * 你可以将其包装放入对应的容器内进行使用。
 * 调用此方法前应该设置某些参数。如:prefixThreadName.
 * @param preStartFlag      {@link }
 * @param corePoolSize      {@link java.util.concurrent.ThreadPoolExecutor#corePoolSize}
 * @param maximumPoolSize   {@link java.util.concurrent.ThreadPoolExecutor#maximumPoolSize}
 * @param keepAliveTime     {@link java.util.concurrent.ThreadPoolExecutor#keepAliveTime}
 * @param unit               keepAliveTime的时间单位。
 * @param workQueue         {@link java.util.concurrent.ThreadPoolExecutor#workQueue}
 * @param threadFactory     {@link java.util.concurrent.ThreadPoolExecutor#threadFactory}  可以为null。取JDK默认线程工厂。
 * @param handler           {@link java.util.concurrent.ThreadPoolExecutor#handler}         可以为null。取当前JDK线程池默认策略。
 * @param threadGroup       {@link CustomizableDefaultThreadFactory#group}                  可以为null。取当前调用线程的线程组。
 * @return  CURRENT_THREAD_POOL_EXECUTOR
 */
public static CustomizableThreadPoolExecutor startInitializeCustomThreadPoolExecutor(@Nullable boolean preStartFlag, @Nullable int corePoolSize,
                                                                                     @Nullable int maximumPoolSize, @Nullable long keepAliveTime,
                                                                                     @Nullable TimeUnit unit, @Nullable BlockingQueue<Runnable> workQueue,
                                                                                     ThreadFactory threadFactory, RejectedExecutionHandler handler,
                                                                                     ThreadGroup threadGroup) {
    //确保实例化此线程池在锁的范围内。变异的DCL。
    EXECUTOR_LOCK.lock();
    ThreadPoolExecutor executor= null;;
    try {
        if(Objects.nonNull(CURRENT_THREAD_POOL_EXECUTOR)) {
            //throw new RuntimeException("The current thread pool has been started");
            return CURRENT_THREAD_POOL_EXECUTOR;
        }

        if(Objects.isNull(threadFactory)) {
            //threadFactory = new CustomizableDefaultThreadFactory(null, THREAD_PREFIX);
            threadFactory = getDefaultCustomizableThreadFactory(threadGroup, THREAD_PREFIX);
        } else {
            //todo. do nothing. get thread group from your param.
        }
        //构造必要线程池。
        if(Objects.nonNull(threadFactory) && Objects.nonNull(handler)) {
            executor = new CustomizableThreadPoolExecutor(preStartFlag, corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, threadFactory, handler);
        } else if(Objects.isNull(threadFactory) && Objects.isNull(handler)) {
            executor = new CustomizableThreadPoolExecutor(preStartFlag, corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, threadFactory);
        } else if(Objects.isNull(threadFactory)) {
            executor = new CustomizableThreadPoolExecutor(preStartFlag, corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, threadFactory, handler );
        } else if(Objects.isNull(handler)) {
            executor = new CustomizableThreadPoolExecutor(preStartFlag, corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, threadFactory);
        } else {
            //不可能发生的.
        }
    } finally {
        EXECUTOR_LOCK.unlock();
    }
    CURRENT_THREAD_POOL_EXECUTOR = (CustomizableThreadPoolExecutor) executor;
    return CURRENT_THREAD_POOL_EXECUTOR;
}
 
Example #7
Source File: Driver.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Prints the usage screen and exits the process.
 *
 * @param opts
 *      If the parsing of options have started, set a partly populated
 *      {@link Options} object.
 */
public static void usage( @Nullable Options opts, boolean privateUsage ) {
    System.out.println(Messages.format(Messages.DRIVER_PUBLIC_USAGE));
    if (privateUsage) {
        System.out.println(Messages.format(Messages.DRIVER_PRIVATE_USAGE));
    }

    if( opts!=null && !opts.getAllPlugins().isEmpty()) {
        System.out.println(Messages.format(Messages.ADDON_USAGE));
        for (Plugin p : opts.getAllPlugins()) {
            System.out.println(p.getUsage());
        }
    }
}
 
Example #8
Source File: OperationDispatcher.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public OperationDispatcher(@NotNull WSDLPort wsdlModel, @NotNull WSBinding binding, @Nullable SEIModel seiModel) {
    this.binding = binding;
    opFinders = new ArrayList<WSDLOperationFinder>();
    if (binding.getAddressingVersion() != null) {
        opFinders.add(new ActionBasedOperationFinder(wsdlModel, binding, seiModel));
    }
    opFinders.add(new PayloadQNameBasedOperationFinder(wsdlModel, binding, seiModel));
    opFinders.add(new SOAPActionBasedOperationFinder(wsdlModel, binding, seiModel));

}
 
Example #9
Source File: Base64Data.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Fills in the data object by a portion of the byte[].
 *
 * @param len
 *      data[0] to data[len-1] are treated as the data.
 */
public void set(byte[] data, int len, @Nullable String mimeType) {
    this.data = data;
    this.dataLen = len;
    this.dataHandler = null;
    this.mimeType = mimeType;
}
 
Example #10
Source File: BGMBuilder.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * If the component maps to a property, forwards to purple, otherwise to green.
 *
 * If the component is mapped to a type, this method needs to return true.
 * See the chart at the class javadoc.
 */
public void ying( XSComponent sc, @Nullable XSComponent referer ) {
    if(sc.apply(toPurple)==true || getClassSelector().bindToType(sc,referer)!=null)
        sc.visit(purple);
    else
        sc.visit(green);
}
 
Example #11
Source File: StreamMessage.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private void init(@NotNull TagInfoset envelopeTag, @Nullable TagInfoset headerTag, @NotNull AttachmentSet attachmentSet, @Nullable MessageHeaders headers, @Nullable String bodyPrologue, @NotNull TagInfoset bodyTag, @Nullable String bodyEpilogue, @NotNull XMLStreamReader reader, @NotNull SOAPVersion soapVersion) {
    init(headers,attachmentSet,reader,soapVersion);
    if(envelopeTag == null ) {
        throw new IllegalArgumentException("EnvelopeTag TagInfoset cannot be null");
    }
    if(bodyTag == null ) {
        throw new IllegalArgumentException("BodyTag TagInfoset cannot be null");
    }
    this.envelopeTag = envelopeTag;
    this.headerTag = headerTag;
    this.bodyTag = bodyTag;
    this.bodyPrologue = bodyPrologue;
    this.bodyEpilogue = bodyEpilogue;
}
 
Example #12
Source File: UsesJAXBContextFeature.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates {@link UsesJAXBContextFeature}.
 * This version allows you to create {@link JAXBRIContext} upfront and uses it.
 */
public UsesJAXBContextFeature(@Nullable final JAXBRIContext context) {
    this.factory = new JAXBContextFactory() {
        @NotNull
        public JAXBRIContext createJAXBContext(@NotNull SEIModel sei, @NotNull List<Class> classesToBind, @NotNull List<TypeReference> typeReferences) throws JAXBException {
            return context;
        }
    };
}
 
Example #13
Source File: CAttributePropertyInfo.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @param type
 *      Represents the bound type of this attribute.
 * @param typeName
 *      XML Schema type name of this attribute. Optional for other schema languages.
 */
public CAttributePropertyInfo(String name, XSComponent source, CCustomizations customizations,
                              Locator locator, QName attName, TypeUse type, @Nullable QName typeName,
                              boolean required ) {
    super(name, type, typeName, source, customizations, locator);
    isRequired = required;
    this.attName = attName;
}
 
Example #14
Source File: DispatchImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private static String checkQuery(@Nullable String query) {
    if (query == null) return null;

    if (query.indexOf('?') == 0)
       throw new WebServiceException(DispatchMessages.INVALID_QUERY_LEADING_CHAR(query));
    return query;
}
 
Example #15
Source File: WSEndpointReference.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates an EPR from individual components.
 *
 * <p>
 * This version takes various information about metadata, and creates an EPR that has
 * the necessary embedded WSDL.
 */
public WSEndpointReference(@NotNull AddressingVersion version,
                           @NotNull String address,
                           @Nullable QName service,
                           @Nullable QName port,
                           @Nullable QName portType,
                           @Nullable List<Element> metadata,
                           @Nullable String wsdlAddress,
                           @Nullable List<Element> referenceParameters) {
   this(version, address, service, port, portType, metadata, wsdlAddress, null, referenceParameters, null, null);
}
 
Example #16
Source File: JsonUtils.java    From leyou with Apache License 2.0 5 votes vote down vote up
@Nullable
public static <K, V> Map<K, V> parseMap(String json, Class<K> kClass, Class<V> vClass) {
    try {
        return mapper.readValue(json, mapper.getTypeFactory().constructMapType(Map.class, kClass, vClass));
    } catch (IOException e) {
        logger.error("json解析出错:" + json, e);
        return null;
    }
}
 
Example #17
Source File: JsonUtils.java    From leyou with Apache License 2.0 5 votes vote down vote up
@Nullable
public static <E> List<E> parseList(String json, Class<E> eClass) {
    try {
        return mapper.readValue(json, mapper.getTypeFactory().constructCollectionType(List.class, eClass));
    } catch (IOException e) {
        logger.error("json解析出错:" + json, e);
        return null;
    }
}
 
Example #18
Source File: HttpClientTransport.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
protected @Nullable InputStream readResponse() {
    InputStream is;
    try {
        is = httpConnection.getInputStream();
    } catch(IOException ioe) {
        is = httpConnection.getErrorStream();
    }
    if (is == null) {
        return is;
    }
    // Since StreamMessage doesn't read </s:Body></s:Envelope>, there
    // are some bytes left in the InputStream. This confuses JDK and may
    // not reuse underlying sockets. Hopefully JDK fixes it in its code !
    final InputStream temp = is;
    return new FilterInputStream(temp) {
        // Workaround for "SJSXP XMLStreamReader.next() closes stream".
        // So it doesn't read from the closed stream
        boolean closed;
        @Override
        public void close() throws IOException {
            if (!closed) {
                closed = true;
                while(temp.read(THROW_AWAY_BUFFER) != -1);
                super.close();
            }
        }
    };
}
 
Example #19
Source File: DispatchImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
static void checkNullAllowed(@Nullable Object in, RequestContext rc, WSBinding binding, Service.Mode mode) {

        if (in != null)
            return;

        //With HTTP Binding a null invocation parameter can not be used
        //with HTTP Request Method == POST
        if (isXMLHttp(binding)){
            if (methodNotOk(rc))
                throw new WebServiceException(DispatchMessages.INVALID_NULLARG_XMLHTTP_REQUEST_METHOD(HTTP_REQUEST_METHOD_POST, HTTP_REQUEST_METHOD_GET));
        } else { //soapBinding
              if (mode == Service.Mode.MESSAGE )
                   throw new WebServiceException(DispatchMessages.INVALID_NULLARG_SOAP_MSGMODE(mode.name(), Service.Mode.PAYLOAD.toString()));
        }
    }
 
Example #20
Source File: XMLStreamWriterFactory.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Fetchs an instance from the pool if available, otherwise null.
 */
private @Nullable XMLStreamWriter fetch() {
    XMLStreamWriter sr = pool.get();
    if(sr==null)    return null;
    pool.set(null);
    return sr;
}
 
Example #21
Source File: PolicyResolver.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public @Nullable Class getEndpointClass() {
   return endpointClass;
}
 
Example #22
Source File: EditableWSDLBoundOperation.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
@Nullable EditableWSDLPart getPart(@NotNull String partName, @NotNull Mode mode);
 
Example #23
Source File: Fiber.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Gets the context {@link ClassLoader} of this fiber.
 */
public
@Nullable
ClassLoader getContextClassLoader() {
    return contextClassLoader;
}
 
Example #24
Source File: HttpAdapter.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
protected @Override @Nullable String getAcceptableMimeTypes(WSHTTPConnection con) {
    return null;
}
 
Example #25
Source File: EditableWSDLBoundPortType.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
@Nullable EditableWSDLBoundOperation getOperation(String namespaceUri, String localName);
 
Example #26
Source File: EditableWSDLOperation.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
@Nullable
EditableWSDLOutput getOutput();
 
Example #27
Source File: PolicyResolver.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public @Nullable PolicyMap getPolicyMap() {
    return policyMap;
}
 
Example #28
Source File: ClientTubeAssemblerContext.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * This constructor should be used only by JAX-WS Runtime and is not meant for external consumption.
 * @deprecated
 *      Use {@link #ClientTubeAssemblerContext(EndpointAddress, WSDLPort, WSService, WSBindingProvider, WSBinding, Container, Codec, SEIModel, Class)}
 */
public ClientTubeAssemblerContext(@NotNull EndpointAddress address, @Nullable WSDLPort wsdlModel,
                                  @NotNull WSService rootOwner, @NotNull WSBinding binding,
                                  @NotNull Container container, Codec codec) {
    this(address, wsdlModel, rootOwner, binding, container, codec, null, null);
}
 
Example #29
Source File: WSDLOperationFinder.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public WSDLOperationFinder(@NotNull WSDLPort wsdlModel, @NotNull WSBinding binding, @Nullable SEIModel seiModel) {
    this.wsdlModel = wsdlModel;
    this.binding = binding;
    this.seiModel= seiModel;
}
 
Example #30
Source File: OldBridge.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @since 2.0.3
 */
public final @NotNull T unmarshal(@NotNull Source in, @Nullable AttachmentUnmarshaller au) throws JAXBException {
    Unmarshaller u = context.unmarshallerPool.take();
    u.setAttachmentUnmarshaller(au);
    return exit(unmarshal(u,in),u);
}