neilcsmith-net commented on code in PR #9736: URL: https://github.com/apache/netbeans/pull/9736#discussion_r4387636333
########## ide/generic.project/src/org/netbeans/modules/generic/project/GpAuxiliaryProperties.java: ########## @@ -0,0 +1,242 @@ +/* + * 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.netbeans.modules.generic.project; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; +import java.util.logging.Level; +import java.util.logging.Logger; +import org.netbeans.spi.project.AuxiliaryProperties; +import org.openide.filesystems.FileObject; +import org.openide.filesystems.FileUtil; +import org.openide.util.NbBundle.Messages; + +/** + * The {@link AuxiliaryProperties} of a generic project, stored in a + * single {@link Properties} file per project (name brandable via the + * module bundle, defaults to {@code .nbgp}). + * + * <p>The file's location depends on the project's nature: for a + * project with the marker file the marker + * ({@link GenericProject#MARKER_FILE}) <em>is</em> the data file, so + * the data is versioned along with the project; for a local + * (marker-less) project it lives in the user configuration + * (see {@link #dataFolder}), so that nothing auxiliary is written + * into the working tree. Shared and private settings are + * distinguished by a {@code shared} / {@code private} key prefix. + * + * <p>The location is re-evaluated on every access: if the marker + * file is created or deleted while the project is open, the data is + * moved to the new location on the next access (the file at the old + * one is removed); if it is deleted while no instance of the project + * is open, the data is lost with it. + */ +final class GpAuxiliaryProperties implements AuxiliaryProperties { Review Comment: I have some concerns about this implementation. I'm not sure it should be handling migration. And non-shared properties should remain non-shared. It's probably better to wrap two independent storage locations for shared / non-shared. Moving the Generic Projects _own_ properties from non-shared to shared storage should probably be done elsewhere in conversion, by calling into the implementation, rather than trying to handle in here. The [Gradle implementation](https://github.com/apache/netbeans/blob/9a986deeffb9ce88b3423d29ddde734b5e5d61c3/extide/gradle/src/org/netbeans/modules/gradle/GradleAuxiliaryPropertiesImpl.java) might be useful to consider here? Including use of `EditableProperties`? If the marker file is used as project property storage, should it have a `.properties` suffix so it can be opened for editing? If the marker file doesn't exist and there are problems with certain settings causing it to be created, then this could store shared properties in a separate config area file that gets copied. Probably easier than trying to filter by prefix? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
