diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-11 23:07:37 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-11 23:07:37 +0000 |
commit | 9f395ebf3ec27f89c8dc63137bc99c8d6b0cff6d (patch) | |
tree | 34231d72966aa918e80eea15602b6870d8b21641 /branches/sca-java-1.2/modules/workspace-admin/src/main/java/org/apache/tuscany/sca/workspace/admin/impl/FileCollectionImpl.java | |
parent | 07b7dfd1a70ba222b899d9813f8c449dbf3b785f (diff) |
Moving 1.x branches
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835125 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.2/modules/workspace-admin/src/main/java/org/apache/tuscany/sca/workspace/admin/impl/FileCollectionImpl.java')
-rw-r--r-- | branches/sca-java-1.2/modules/workspace-admin/src/main/java/org/apache/tuscany/sca/workspace/admin/impl/FileCollectionImpl.java | 129 |
1 files changed, 0 insertions, 129 deletions
diff --git a/branches/sca-java-1.2/modules/workspace-admin/src/main/java/org/apache/tuscany/sca/workspace/admin/impl/FileCollectionImpl.java b/branches/sca-java-1.2/modules/workspace-admin/src/main/java/org/apache/tuscany/sca/workspace/admin/impl/FileCollectionImpl.java deleted file mode 100644 index 241dc6f55b..0000000000 --- a/branches/sca-java-1.2/modules/workspace-admin/src/main/java/org/apache/tuscany/sca/workspace/admin/impl/FileCollectionImpl.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * 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.workspace.admin.impl; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.logging.Logger; - -import org.apache.tuscany.sca.implementation.data.collection.Entry; -import org.apache.tuscany.sca.implementation.data.collection.Item; -import org.apache.tuscany.sca.implementation.data.collection.ItemCollection; -import org.apache.tuscany.sca.implementation.data.collection.NotFoundException; -import org.osoa.sca.annotations.Init; -import org.osoa.sca.annotations.Property; -import org.osoa.sca.annotations.Scope; -import org.osoa.sca.annotations.Service; - -/** - * Implementation of a file collection service component. - * - * @version $Rev$ $Date$ - */ -@Scope("COMPOSITE") -@Service(ItemCollection.class) -public class FileCollectionImpl implements ItemCollection { - - private final static Logger logger = Logger.getLogger(FileCollectionImpl.class.getName()); - - @Property - public String directoryName; - - /** - * Initialize the component. - */ - @Init - public void initialize() throws IOException { - } - - public Entry<String, Item>[] getAll() { - logger.info("getAll"); - - // Return all the files - List<Entry<String, Item>> entries = new ArrayList<Entry<String, Item>>(); - File directory = new File(directoryName); - if (directory.exists()) { - for (File file: directory.listFiles()) { - if (file.getName().startsWith(".")) { - continue; - } - entries.add(entry(file.getName())); - } - } - return entries.toArray(new Entry[entries.size()]); - } - - public Item get(String key) throws NotFoundException { - logger.info("get " + key); - return item(key); - } - - public String post(String key, Item item) { - throw new UnsupportedOperationException(); - } - - public void put(String key, Item item) throws NotFoundException { - throw new UnsupportedOperationException(); - } - - public void delete(String key) throws NotFoundException { - logger.info("delete " + key); - - File directory = new File(directoryName); - File file = new File(directory, key); - if (file.exists()) { - file.delete(); - } else { - throw new NotFoundException(key); - } - } - - public Entry<String, Item>[] query(String queryString) { - throw new UnsupportedOperationException(); - } - - /** - * Returns an entry representing a file. - * - * @param fileName - * @return - */ - private static Entry<String, Item> entry(String fileName) { - Entry<String, Item> entry = new Entry<String, Item>(); - entry.setKey(fileName); - entry.setData(item(fileName)); - return entry; - } - - /** - * Returns an item representing a file. - * - * @param fileName - * @return - */ - private static Item item(String fileName) { - Item item = new Item(); - item.setTitle(fileName); - item.setLink("/files/" + fileName); - return item; - } -} |