Return-Path: Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: (qmail 41745 invoked from network); 12 Dec 2008 15:10:31 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 12 Dec 2008 15:10:31 -0000 Received: (qmail 18457 invoked by uid 500); 12 Dec 2008 15:10:43 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 18388 invoked by uid 500); 12 Dec 2008 15:10:43 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 18379 invoked by uid 99); 12 Dec 2008 15:10:43 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 Dec 2008 07:10:43 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 Dec 2008 15:10:28 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 580C42388979; Fri, 12 Dec 2008 07:10:07 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r726028 - /cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/OperationResourceInfoComparator.java Date: Fri, 12 Dec 2008 15:10:07 -0000 To: commits@cxf.apache.org From: dkulp@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20081212151007.580C42388979@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: dkulp Date: Fri Dec 12 07:10:06 2008 New Revision: 726028 URL: http://svn.apache.org/viewvc?rev=726028&view=rev Log: Set the eol-style Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/OperationResourceInfoComparator.java (contents, props changed) Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/OperationResourceInfoComparator.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/OperationResourceInfoComparator.java?rev=726028&r1=726027&r2=726028&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/OperationResourceInfoComparator.java (original) +++ cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/OperationResourceInfoComparator.java Fri Dec 12 07:10:06 2008 @@ -1,70 +1,70 @@ -/** - * 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.cxf.jaxrs.model; - -import java.util.Comparator; - -import org.apache.cxf.jaxrs.utils.JAXRSUtils; - -public class OperationResourceInfoComparator implements Comparator { - - public int compare(OperationResourceInfo e1, OperationResourceInfo e2) { - - if (e1.getHttpMethod() != null && e2.getHttpMethod() == null - || e1.getHttpMethod() == null && e2.getHttpMethod() != null) { - // subresource method takes precedence over a subresource locator - return e1.getHttpMethod() != null ? -1 : 1; - } - - - String l1 = e1.getURITemplate().getLiteralChars(); - String l2 = e2.getURITemplate().getLiteralChars(); - if (!l1.equals(l2)) { - // descending order - return l1.length() < l2.length() ? 1 : -1; - } - - int g1 = e1.getURITemplate().getNumberOfGroups(); - int g2 = e2.getURITemplate().getNumberOfGroups(); - if (g1 != g2) { - // descending order - return g1 < g2 ? 1 : -1; - } - - int gCustom1 = e1.getURITemplate().getNumberOfGroupsWithCustomExpression(); - int gCustom2 = e2.getURITemplate().getNumberOfGroupsWithCustomExpression(); - if (gCustom1 != gCustom2) { - // descending order - return gCustom1 < gCustom2 ? 1 : -1; - } - - int result = JAXRSUtils.compareSortedMediaTypes( - e1.getConsumeTypes(), - e2.getConsumeTypes()); - if (result == 0) { - //use the media type of output data as the secondary key. - result = JAXRSUtils.compareSortedMediaTypes(e1.getProduceTypes(), - e2.getProduceTypes()); - } - - return result; - } - -} +/** + * 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.cxf.jaxrs.model; + +import java.util.Comparator; + +import org.apache.cxf.jaxrs.utils.JAXRSUtils; + +public class OperationResourceInfoComparator implements Comparator { + + public int compare(OperationResourceInfo e1, OperationResourceInfo e2) { + + if (e1.getHttpMethod() != null && e2.getHttpMethod() == null + || e1.getHttpMethod() == null && e2.getHttpMethod() != null) { + // subresource method takes precedence over a subresource locator + return e1.getHttpMethod() != null ? -1 : 1; + } + + + String l1 = e1.getURITemplate().getLiteralChars(); + String l2 = e2.getURITemplate().getLiteralChars(); + if (!l1.equals(l2)) { + // descending order + return l1.length() < l2.length() ? 1 : -1; + } + + int g1 = e1.getURITemplate().getNumberOfGroups(); + int g2 = e2.getURITemplate().getNumberOfGroups(); + if (g1 != g2) { + // descending order + return g1 < g2 ? 1 : -1; + } + + int gCustom1 = e1.getURITemplate().getNumberOfGroupsWithCustomExpression(); + int gCustom2 = e2.getURITemplate().getNumberOfGroupsWithCustomExpression(); + if (gCustom1 != gCustom2) { + // descending order + return gCustom1 < gCustom2 ? 1 : -1; + } + + int result = JAXRSUtils.compareSortedMediaTypes( + e1.getConsumeTypes(), + e2.getConsumeTypes()); + if (result == 0) { + //use the media type of output data as the secondary key. + result = JAXRSUtils.compareSortedMediaTypes(e1.getProduceTypes(), + e2.getProduceTypes()); + } + + return result; + } + +} Propchange: cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/OperationResourceInfoComparator.java ------------------------------------------------------------------------------ svn:eol-style = native