Debian Codegraph @

ssl-proxies/src/main/java/org/globus/gsi/stores/ResourceCRL.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.globus.gsi.util.CertificateLoadUtil;
19 import org.globus.util.GlobusResource;
20
21 import java.io.BufferedInputStream;
22 import java.io.IOException;
23 import java.io.InputStream;
24 import java.security.GeneralSecurityException;
25 import java.security.cert.X509CRL;
26
27 /**
28 * Created by IntelliJ IDEA.
29 * User: turtlebender
30 * Date: Dec 29, 2009
31 * Time: 12:41:39 PM
32 * To change this template use File | Settings | File Templates.
33 */
34 public class ResourceCRL extends AbstractResourceSecurityWrapper<X509CRL> {
35
36 public ResourceCRL(String fileName) throws ResourceStoreException {
37 super(false);
38 init(globusResolver.getResource(fileName));
39 }
40
41 public ResourceCRL(boolean inMemory, GlobusResource globusResource) throws ResourceStoreException {
42 super(inMemory);
43 init(globusResource);
44 }
45
46 public ResourceCRL(String fileName, X509CRL crl) throws ResourceStoreException {
47 super(false);
48 init(globusResolver.getResource(fileName), crl);
49 }
50
51 public X509CRL getCrl() throws ResourceStoreException {
52 return getSecurityObject();
53 }
54
55 @Override
56 protected X509CRL create(GlobusResource resource) throws ResourceStoreException {
57 try {
58 InputStream is = resource.getInputStream();
59 try {
60 return CertificateLoadUtil.loadCrl(new BufferedInputStream(is));
61 } finally {
62 try {
63 is.close();
64 } catch (IOException ignored) {
65 }
66 }
67 } catch (IOException e) {
68 throw new ResourceStoreException(e);
69 } catch (GeneralSecurityException e) {
70 throw new ResourceStoreException(e);
71 }
72 }
73
74 public void store() throws ResourceStoreException {
75 //TODO: does this need an implementation
76 }
77 }