@@ -55,7 +55,21 @@ public String list(
5555 return builder .toString ();
5656 }
5757
58- @ CliCommand (value = "featuretype create" , help = "Create a feature type." )
58+ @ CliCommand (value = "featuretype publish" , help = "Publish a feature type from an existing dataset." )
59+ public boolean publish (
60+ @ CliOption (key = "workspace" , mandatory = true , help = "The workspace" ) String workspace ,
61+ @ CliOption (key = "datastore" , mandatory = true , help = "The datastore" ) String datastore ,
62+ @ CliOption (key = "featuretype" , mandatory = true , help = "The featuretype" ) String featuretype
63+ ) throws Exception {
64+ Element rootElement = new Element ("featureType" );
65+ rootElement .addContent (new Element ("name" ).setText (featuretype ));
66+ String xml = JDOMUtil .toString (rootElement );
67+ String url = geoserver .getUrl () + "/rest/workspaces/" + URLUtil .encode (workspace ) + "/datastores/" + URLUtil .encode (datastore ) + "/featuretypes.xml" ;
68+ String response = HTTPUtils .postXml (url , xml , geoserver .getUser (), geoserver .getPassword ());
69+ return response != null ;
70+ }
71+
72+ @ CliCommand (value = "featuretype create" , help = "Create a new feature type." )
5973 public boolean create (
6074 @ CliOption (key = "workspace" , mandatory = true , help = "The workspace" ) String workspace ,
6175 @ CliOption (key = "datastore" , mandatory = true , help = "The datastore" ) String datastore ,
0 commit comments