Debian Codegraph @

ssl-proxies/src/main/java/org/globus/gsi/stores/ResourceCRLStore.java

raw
1 /*
2 * Copyright 1999-2010 University of Chicago
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
5 * compliance with the License. You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software distributed under the License is
10 * distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
11 * express or implied.
12 *
13 * See the License for the specific language governing permissions and limitations under the License.
14 */
15
16 package org.globus.gsi.stores;
17
18 import org.apache.commons.logging.LogFactory;
19
20 import org.apache.commons.logging.Log;
21
22 import java.io.File;
23 import java.io.FilenameFilter;
24 import java.security.cert.X509CRL;
25
26
27 import org.globus.util.GlobusResource;
28
29 /**
30 * Fill Me
31 */
32 public class ResourceCRLStore extends ResourceSecurityWrapperStore<ResourceCRL, X509CRL> {
33
34 private static CrlFilter filter = new CrlFilter();
35 private static final int MIN_NAME_LENGTH = 3;
36 private Log logger = LogFactory.getLog(getClass().getCanonicalName());
37
38 @Override
39 public ResourceCRL create(GlobusResource globusResource) throws ResourceStoreException {
40 return new ResourceCRL(false, globusResource);
41 }
42
43 @Override
44 protected Log getLog() {
45 return logger;
46 }
47
48 @Override
49 public FilenameFilter getDefaultFilenameFilter() {
50 return filter;
51 }
52
53 /**
54 * This filter identifies file whose names are valid for crl files.
55 */
56 public static class CrlFilter implements FilenameFilter {
57
58 public boolean accept(File dir, String file) {
59
60 if (file == null) {
61 throw new IllegalArgumentException();
62 }
63
64 int length = file.length();
65
66 return length > MIN_NAME_LENGTH && file.endsWith(".r09");
67 }
68 }
69 }