Revision 44346 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.api/src/main/java/org/gvsig/fmap/dal/DatabaseWorkspaceManager.java

View differences:

DatabaseWorkspaceManager.java
1 1
package org.gvsig.fmap.dal;
2 2

  
3
import org.apache.commons.lang3.StringUtils;
3 4
import org.gvsig.fmap.dal.feature.FeatureStore;
5
import org.gvsig.tools.resourcesstorage.ResourcesStorage;
4 6

  
5 7
/**
6 8
 *
......
30 32
    public static final String CONFIG_NAME_STORESREPOSITORYID = "StoresRepository.id";
31 33
    public static final String CONFIG_NAME_STORESREPOSITORYLABEL = "StoresRepository.label";
32 34

  
35
    /**
36
     * Check if the indicated name corresponds to one of the configuration tables of the workspace.
37
     * 
38
     * @param name to check.
39
     * @return true if the name is that of a configuration table.
40
     */
41
    public static boolean isInternalTable(String name) {
42
        if( StringUtils.isBlank(name) ) {
43
            return false;
44
        }
45
        String[] internalNames = new String[] {
46
            TABLE_REPOSITORY_NAME,
47
            TABLE_RESOURCES_NAME,
48
            TABLE_CONFIGURATION_NAME
49
        };
50
        for (String internalName : internalNames) {
51
            if( name.equalsIgnoreCase(internalName) ) {
52
                return true;
53
            }
54
        }
55
        return false;
56
    }
57

  
58
    /**
59
     * Returns the identifier of this workspace.
60
     * 
61
     * @return the id.
62
     */
63
    public String getId();
64

  
65
    /**
66
     * Returns the label of this workspace.
67
     * 
68
     * @return the label value.
69
     */
70
    public String getLabel();
71
    
72
    /**
73
     * Gets the value of a configuration variable associated with 
74
     * this work space.
75
     * 
76
     * @param name of the variable to consult 
77
     * @return the value of the variable 
78
     */
33 79
    public String get(String name);
34 80
    
81
    /**
82
     * Assigns the indicated value to the configuration variable.
83
     * 
84
     * @param name of the variable.
85
     * @param value value to set.
86
     * @return true if can assign the value.
87
     */
35 88
    public boolean set(String name, String value);
36 89
    
90
    /**
91
     * Gets the repository of data stores associated with this workspace.
92
     * 
93
     * @return the data stores repository.
94
     */
37 95
    public StoresRepository getStoresRepository();
38 96
    
39
    public boolean storesRepositoryWriteEntry(String name, DataStoreParameters parameters);
97
    /**
98
     * Add a new data store to the workspace.
99
     * 
100
     * @param name of the data store.
101
     * @param parameters to open the data store.
102
     * @return true if ok.
103
     */
104
    public boolean writeStoresRepositoryEntry(String name, DataStoreParameters parameters);
40 105

  
41 106
    public boolean canAnonymousUserWriteInTheTables();
42 107

  
108
    /**
109
     * Check if the indicated configuration table exists in the workspace.
110
     * 
111
     * @param tableid
112
     * @return true if the table exists.
113
     */
43 114
    public boolean existsTable(int tableid);
44 115

  
45
    public FeatureStore getTable(int tableid);
46

  
116
    /**
117
     * Create the configuration table indicated in the workspace.
118
     * 
119
     * @param tableid identifier of the configuration table to create.
120
     */
47 121
    public void createTable(int tableid);
48 122
    
123
    /**
124
     * Remove the indicated configuration table from the workspace.
125
     * 
126
     * @param tableid identifier of the configuration table to remove.
127
     */
49 128
    public void dropTable(int tableid);
50 129

  
130
    /**
131
     * Gets the data store associated with the indicated configuration table.
132
     * 
133
     * @param tableid identifier of the configuration table to get.
134
     * @return the FeatureStore of the configuration table.
135
     */
136
    public FeatureStore getTable(int tableid);
137

  
138
    /**
139
     * Returns true if the connection associated with this object refers 
140
     * to a valid workspace.
141
     * At least the repositories table must exist and the variable 
142
     * "StoresRepository.id" must be defined.
143
     * 
144
     * @return 
145
     */
51 146
    public boolean isValidStoresRepository();
147
    
148
    /**
149
     * If the workspace has an alternate resource storage defined, return it. 
150
     * If don't have it, return null.
151
     * 
152
     * @return the alternate resource storage.
153
     */
154
    public ResourcesStorage getAlternativeResourcesStorage();
155
    
156
    /**
157
     * Create and initialize the tables associated with a gvSIG workspace.
158
     * 
159
     * @param id of the workspace
160
     * @param description of the workspace 
161
     */
162
    public void create(String id, String description);
52 163

  
53 164
}

Also available in: Unified diff